Quantcast

Performance: Octave vs. Matlab

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Performance: Octave vs. Matlab

wkim+
Hi, I'm new to this list.

A few days ago, I got an OS/2 version of octave 1.1 and it was quite
good.  However, after giving a few tests, I found it very slower than
Matlab for Windows.  About 3 times slower on a P90.  I failed to find
a doc that mentioned about performance issue to see if I could boost
Octave's performance.

A free software can be slower or faster than a commercial product,
but 3X slower speed was too big for me to understand.
(I suspect that the OS/2 port might not be optimized when compiling.)
With such slow speed, I doubt I would use octave in a real application.

Maybe I missed something as I don't yet know octave enough.
I want your comments.  Thanks.

//--------------------------------------------------------------------
// Wonkoo Kim
// [hidden email]

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Performance: Octave vs. Matlab

John Eaton-4
[hidden email] wrote:

: A few days ago, I got an OS/2 version of octave 1.1 and it was quite
: good.  However, after giving a few tests, I found it very slower than
: Matlab for Windows.  About 3 times slower on a P90.  I failed to find
: a doc that mentioned about performance issue to see if I could boost
: Octave's performance.
:
: A free software can be slower or faster than a commercial product,
: but 3X slower speed was too big for me to understand.

Why?

: (I suspect that the OS/2 port might not be optimized when compiling.)
: With such slow speed, I doubt I would use octave in a real application.

Why not?  There are many things that Octave does that are as fast or
faster than Matlab, and even some things that Octave can do that
Matlab can't.

I think there are many reasons to choose to use Octave that have
nothing to do with speed.  In fact, if you are after really fast
solutions, any interpreted language like Octave, RLaB, Scilab, Matlab,
or U-Name-it-Lab :-), is probably not your best bet anyway.

: Maybe I missed something as I don't yet know octave enough.
: I want your comments.  Thanks.

You might want to read the comments I made in an earlier message to
this list

  http://www.che.utexas.edu/octave-mailing-lists/help-octave/1995/64

and also available via anonymous ftp from ftp.che.utexas.edu in the
directory /pub/octave/MAILING-LISTS/help-octave/1995.

Thanks,

jwe

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Performance: Octave vs. Matlab

wkim+
In reply to this post by wkim+
> Date: Tue, 02 May 95 12:47:41 -0400
> From: "John Eaton" <[hidden email]>
>
> [hidden email] wrote:
>
> :...
> : A free software can be slower or faster than a commercial product,
> : but 3X slower speed was too big for me to understand.
>
> Why?
>
> : With such slow speed, I doubt I would use octave in a real application.
>
> Why not?  There are many things that Octave does that are as fast or
> faster than Matlab, and even some things that Octave can do that
> Matlab can't.
> I think there are many reasons to choose to use Octave that have
> nothing to do with speed.  In fact, if you are after really fast
> solutions, any interpreted language like Octave, RLaB, Scilab, Matlab,
> or U-Name-it-Lab :-), is probably not your best bet anyway.

Yes, of course there are many reasons to use an interpreter for
simple simulations instead of writing programs in C, C++, etc..  
Why not wishing to have a faster one when we have several
choices of similar interpreters?  I agree that Octave has things
that Matlab can't offer, but the reverse is also true.  As long as
both packages can fit my needs, more or less features are not major
factor (at least to me) in choosing one.  An interpreter is an
interpreter (nothing but an interpreter :-)) and is usually for
simple simulations (unless it can generate an executable).
A good thing of octave is it's 'free' (THANKS!).  When I can use
Matlab (site-licensed), a big preformance gap could affect my
choice.

Here is a session of Matlab:

¯ tic; bench1(10); toc

elapsed_time =

   11.0900

¯

The bench1.m was
----------------------------
function [z] = bench1 (n)
for i=1:n,
    for j=1:1000,
        z=log(j);
        z1=log(j+1);
        z2=log(j+2);
        z3=log(j+3);
        z4=log(j+4);
        z5=log(j+5);
        z6=log(j+6);
        z7=log(j+7);
        z8=log(j+8);
        z9=log(j+9);
    end
end
z = z9;
----------------------------

And, for the same program (translated keywords only), octave 1.1.0 for
OS/2 gave 32 seconds which is about 3 times slower than Matlab for Win.
and cannot be said as "slight" overheads.  How do you think?

BTW, I found there exists ver. 1.1.1, but my OS/2 version is 1.1.0.
Can I expect a newer version of octave for OS/2 soon?
(There were bugs in octave 1.1.0.)
Can I have getl() function like the one in Matlab?

Thank you.

//--------------------------------------------------------------------
// Wonkoo Kim
// [hidden email]

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Performance: Octave vs. Matlab

John Eaton-4
In reply to this post by wkim+
[hidden email] wrote:

: Yes, of course there are many reasons to use an interpreter for
: simple simulations instead of writing programs in C, C++, etc..  
: Why not wishing to have a faster one when we have several
: choices of similar interpreters?

I agree that it would be nice for Octave to be faster, and I have done
some work to try to make this happen.  However, I have to be careful to
judge whether the time spent working on speeding up the interpreter is
worth it.  It could be spent doing other things, like improving the
plotting or string handling capabilities.

If you really want Octave to be faster, you have the source code, and
you can work on making it faster.  If you do, I hope you will share
the changes with the rest of us!

: Here is a session of Matlab:
:
: ¯ tic; bench1(10); toc
:
: elapsed_time =
:
:    11.0900
:
: ¯
:
: The bench1.m was
: ----------------------------
: function [z] = bench1 (n)
: for i=1:n,
:     for j=1:1000,
:         z=log(j);
:         z1=log(j+1);
:         z2=log(j+2);
:         z3=log(j+3);
:         z4=log(j+4);
:         z5=log(j+5);
:         z6=log(j+6);
:         z7=log(j+7);
:         z8=log(j+8);
:         z9=log(j+9);
:     end
: end
: z = z9;

: And, for the same program (translated keywords only), octave 1.1.0 for
: OS/2 gave 32 seconds which is about 3 times slower than Matlab for Win.
: and cannot be said as "slight" overheads.  How do you think?

Running this on a SPARCstation 2 with 1.1.1 took 160 CPU seconds.
With the current development version, it took 135.  Maybe this could
be even better if someone were to spend some time working on it.  (I
probably won't spend much time on it, since there are many things that
I think are more important to work on right now.)

: BTW, I found there exists ver. 1.1.1, but my OS/2 version is 1.1.0.
: Can I expect a newer version of octave for OS/2 soon?

I don't know.  I've got the changes to port 1.1.0 to OS/2, but haven't
finished merging them in.  I hope that OS/2 will be supported `out of
the box' in 1.2, but I don't have an OS/2 system to work with, so I
have to depend on others to help out.  Luckily, some people have been
willing to help.  Without them, there would be no OS/2 version at all.

: Can I have getl() function like the one in Matlab?

It is on the list of things to do, but so far no one has written it.

jwe

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Performance: Octave vs. Matlab

wkim+
In reply to this post by wkim+
> It could be spent doing other things, like improving the
> plotting or string handling capabilities.
>
> If you really want Octave to be faster, you have the source code, and
> you can work on making it faster.  If you do, I hope you will share
> the changes with the rest of us!

Oops, it seems to be beyond of my capability. :-)

When I mentioned "performance" issue, I thought that I could
have missed something like 'compile' option switch that may
boost the speed.  Unfortunately, there was no such thing.

I really thank you for your kind and responsive answers.
Octave as a user-supported 'free' software is great anyway!
I'll wait for ver. 1.2 (or 1.1.1?) for OS/2 (as I have troubles
with 1.1.0; feof() didn't work and it lacks some functions that
I needed.).  I don't know any features of 1.1.1 or 1.2, but 1.1.0
needs better string and file manipulations.

Oh, I have a question:  Can I pass a file pointer to my function?
Calling foo(infile) after infile=fopen("data.dat") seemed not work.
It seemed like foo() didn't know the file.

I was dealing with data file that had some texts in header,
but I was in troubles (indexing string var, feof(), getl(), etc.).
But, now I realized that I should wait for 1.1.1 or 1.2, so I just
need a quick answer to the above question for this moment.

Thanks again, John Eaton.

//--------------------------------------------------------------------
// Wonkoo Kim
// [hidden email]

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Performance: Octave vs. Matlab

wkim+
In reply to this post by wkim+
> From: "John Eaton" <[hidden email]>
> To: [hidden email]
>
> [hidden email] wrote:
>
> : And, for the same program (translated keywords only), octave 1.1.0 for
> : OS/2 gave 32 seconds which is about 3 times slower than Matlab for Win.
> : and cannot be said as "slight" overheads.  How do you think?
>
> Running this on a SPARCstation 2 with 1.1.1 took 160 CPU seconds.
> With the current development version, it took 135.  Maybe this could
> be even better if someone were to spend some time working on it.  (I
> probably won't spend much time on it, since there are many things that
> I think are more important to work on right now.)
 
Could you tell me what optimization level was used when compiling
Octave 1.1.0 for OS/2 with emx/gcc 0.9a?

I remember that -O switches (of gcc 2.6.3) gave weird results in
exection speed.  A funny result was that -O2 (which is the default)
generated slower code than no optimization for a simple loop test
(like the one I posted before here.) if loop variables are 'double'
instead of 'int'.  I posted it to emx-list and people reported the
same problem and so I sent a bug report to bug-gcc a month ago.
(A person posted that he identified the source of the bug.)
I suspect that Octave's slow performance might come from gcc's
fault (in dealing with floating-point math).

Thanks.

//--------------------------------------------------------------------
// Wonkoo Kim
// [hidden email]

Loading...