I only have a little coding experience in C, and I remember I was told that pass by reference is more efficient than pass by value since the parameters don't need to be copied. Since there is no pass by reference in Mathematica, I'm wondering if that affects the performance of function calls, especially when dealing with large data?
Tell me more
×
Mathematica Stack Exchange is a question and answer site for
users of Mathematica. It's 100% free, no registration required.
|
In Mathematica, this does not affect performance because copying does not take place most of the time. To put it simply, Mathematica implements copy-on-demand: it creates a copy of the data structure only if it is modified. Please see this answer for a more detailed explanation: Does passing a variable with a large amount of data cost a lot of memory and time in Mathematica? |
|||||||||
|

Unevaluated, which is a wrong thing to do from the software development perspective. Instead,Hold- attributes should be used, as I emphasized in my answer there, and then also here. – Leonid Shifrin Mar 8 at 1:12Unevaluated[]any more. – Nasser Mar 8 at 1:22