help-octave
[Top][All Lists]
Advanced

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

Re: octave benchmark test


From: Paul Kienzle
Subject: Re: octave benchmark test
Date: Tue, 9 Mar 2004 19:48:14 -0500


On Mar 9, 2004, at 5:50 PM, Henry F. Mollet wrote:



Vectorize code wherever possible!!!!! Octave doesn't have JIT which is
where Matlab wins on this case.

Can someone please tell me what JIT is, and explain why Octave does not
have/could not do JIT, if Octave has/does almost everything else that Matlab
has/does?

Just In Time compiler.

For best effect, you want to turn:

        function total=sum(x)
                total=0; for i=1:n, total+=x(i); end

into something like:

        double total = 0;
        int i; for (i=0; i < n; i++) total += x[i];
        return total;

If that looks easy, consider that x may be real or complex or
a sparse matrix or a galois field or a indefinite precision
number, ...  And consider that the size of x may be less than
n.  And consider that x may be a function (matlab syntax does
not distinguish between functions and array indexing), which
returns a different value type for each i.  You don't know until
you call the function what the type of x is.

The function case is particularly tricky since there are no
guarantees.  For example, I can override the builtin sin
function so that it returns strings.  Or the function that I'm
calling could replace a builtin function during the loop.

Yes you can build in checks to make sure the results are
as expected.  If you are not careful, though, you will end
up rebuilding the octave interpreter, and it won't be any
faster.

We could probably hack in some simple cases which
would make the benchmarks look good.  Some of them
would even be practical.  I'm sure if you poke at the matlab
interpreter enough you will find places where their
optimization doesn't result in any speed up.  Try for example
putting an eval statement in the loop (after eval, all bets
are off).

Paul Kienzle
address@hidden



-------------------------------------------------------------
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]