Next: Comment Tips, Previous: Style Tips, Up: Tips
Here are some ways of improving the execution speed of Octave programs.
result = zeros (big_n, big_m)
for i = over:and_over
r1 = ...
r2 = ...
result (r1, r2) = new_value ();
endfor
instead of
result = [];
for i = ever:and_ever
result = [ result, new_value() ];
endfor
eval or feval whenever possible, because
they require Octave to parse input or look up the name of a function in
the symbol table.
If you are using eval as an exception handling mechanism and not
because you need to execute some arbitrary text, use the try
statement instead. See The try Statement.
ignore_function_time_stamp to "all" so that Octave doesn't
waste a lot of time checking to see if you have updated your function
files.