I’m not interested in concrete values, but just theoretical answers.
-
For example, in loops when we need
to use the same values over and
over, would it work faster if values
would be passed by reference instead
of value? -
And what about objects? Assuming
that our object contains some values
for this specific instance of an
object. Instead of instantiating new
object, can we pass it by reference
to gain performance wise? Or should
wecloneit?
I hope I’ve made myself clear, thanks in advance.
If all you are interested in is performance, then as a general rule, pass by reference performs better than pass by value.