[Top][All Lists]

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

Re: profiler and/or debugger, loops vs vectorization

From: David Grohmann
Subject: Re: profiler and/or debugger, loops vs vectorization
Date: Wed, 05 Jul 2006 12:31:43 -0500
User-agent: Thunderbird (Windows/20060516)

John W. Eaton wrote:
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);

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.

unfortunately some of the loops are a little more complex then that, and I'm a novice at matlab. The solution we will probably take is to just make an oct file for that segment and write it in c++

i get tripped up when the looping variable is being used to do something else besides just indexing into another vector.

David Grohmann
Senior Student Associate
Applied Research Lab : UT Austin : ESL - S206
Office: 512-835-3237
Cell: 210-861-6882

reply via email to

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