help-octave
[Top][All Lists]
Advanced

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

Re:


From: Shai Ayal
Subject: Re:
Date: Mon, 20 Mar 2006 06:56:54 +0200
User-agent: Thunderbird 1.5 (Windows/20051201)

I think this is a real-world problem. It is probably the biggest flaw in the matlab language, making you write programs which use unintuitive and hard to understand tricks just to avoid for-loops. As a real world example, have a look at the code for hist.m in octave. Instead of a ~N for-loop, it uses NlogN sorting just because sort is done in C and thus is faster.

I think that for-loops are an essential part of any programming language, and avoiding them has unfortunately become the hallmark of good matlab programming. When conducting job interviews for positions for which matlab/octave is relevant, one of my questions is:

how would you calculate a 10 sample running average on a 100 element vector?

The answer should be trivial with a for-loop, but of course in the octave/matlab language it is not the "recommended" way. If I get the for-loop answer I immediately understand that this person has no real-life experience with octave/matlab.

Shai

p.s. This is not a rant against octave, rather against the matlab language. I understand that JIT for octave is probably not an achievable goal, and I will continue to use tricks because of the numerous other advantages of octave.

Arvid Rosén wrote:
Jordi Gutierrez Hermoso wrote:
Of all the complaints I have heard about Octave, its slowness is the
one that stings the most painfully. Cuts deep. Real deep.

So, I'm interested to know, any idea why this is happening? Why would
a simple for loop with no code to execute except running through all
the values of its iterator take orders of magnitude more in Octave
than in Matlab?

Where are these benchmarks?
Is this really a real-world problem? Do you people often run into situations where the interpreter speed is the limiting factor. I don't think I do, but I guess it depend on what kind of problems you are working on. I just want to say that running empty for-loops is certainly not the way to test the quality of Octave as a whole and it might not be a good way to test the interpreter either. If you really depend on tiny for-loops, you should probably rewrite your code anyway.

/Arvid



-------------------------------------------------------------
Octave is freely available under the terms of the GNU GPL.

Octave's home on the web:  http://www.octave.org
How to fund new projects:  http://www.octave.org/funding.html
Subscription information:  http://www.octave.org/archive.html
-------------------------------------------------------------




-------------------------------------------------------------
Octave is freely available under the terms of the GNU GPL.

Octave's home on the web:  http://www.octave.org
How to fund new projects:  http://www.octave.org/funding.html
Subscription information:  http://www.octave.org/archive.html
-------------------------------------------------------------



reply via email to

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