help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: profiler and/or debugger, loops vs vectorization


From: John W. Eaton
Subject: Re: profiler and/or debugger, loops vs vectorization
Date: Wed, 5 Jul 2006 12:13:12 -0400

On  5-Jul-2006, David Grohmann wrote:

| Octave was on a linux machine, matlab was on a windows machine.
| 
| However it seems that vectorizing the code makes up the difference. I 
| didn't know that such a performance boost would happen with vectorization.

Looping is slow in Octave.  Looping used to be slow in Matlab, but
recent versions have a just-in-time compiler that makes looping much
faster, so now people are starting to write old-time-fortran-style
loops in Matlab to do things that can be neatly expressed in
matrix-vector operations (this is progress?).  OK, sometimes writing
matrix-vector operations obscures what is happening, but many times it
is much cleaner to write matrix-vector code.  I'd bet there are even
some people out there who are now writing things like

  xsum = 0.
  for i = 1:n
    xsum = xsum + x(i);
  end

instead of just writing using the sum function.

In any case, comparing Octave vs. Matlab on a for loop is not really a
fair comparison.  If you are wondering when Octave will have the same
kind of JIT capability, then the answer is when someone contributes
the code to do it, or provides sufficient funding to make it happen.

jwe


reply via email to

[Prev in Thread] Current Thread [Next in Thread]