Changes

Jump to navigation Jump to search

Performance

61 bytes added, 00:11, 22 May 2012
highlighting
When passing variables to a function, Octave will only make a copy of it is going to be modified. That is, unless the argument needs to be changed, the variable will be like a reference and take no extra memory or time to write.
{{Code|Looking at lazy copying|<presyntaxhighlight lang="matlab" style="font-size:13px">
function read_arg (arg)
x = arg(1);
t = cputime (); modi_arg (a); t_read = cputime () -t ## takes some time since a copy of a will be made to be modified
t = cputime (); chan_arg (a); t_read = cputime () -t ## takes NO time since even though arg is modifed, it's not based on the original value
</presyntaxhighlight>}}
=== Global variables ===
651

edits

Navigation menu