Saturday, September 13, 2008

MatLab vs Octave Benchmark

I just thought I'd share some informal benchmarking results with the world. This is with Octave 3.0.0 and MatLab 2008a. I'm running on Ubuntu Linux, 8.04, 64-bit, with an AMD Athlon X2, 2.2 GHz processor, and 2 GB of RAM. I wrote a little modulator-demodulator thingy, which is not very fancy at all. Its just a couple of for-loops, some non-vectorized Euclidean-distance calculations, and some comparisons.

Octave : 7.5 Seconds
MatLab : 1.5 Seconds

That's a 5x speed advantage for MatLab. I like open-source stuff, and Octave is lighter-weight, so I'll still use it, but MatLab sure shows off the fact that it has been low-level optimized. When I need a 5x speed boost, I'll certainly power up MatLab, and when I need way more than that, well, then its time to go to C++, and move things over to my cluster :)

2 comments:

Unknown said...

Well especially at "for" loops octave is _very_ slow since it just interprets. But compiled functions haven't got that much of a difference. If you vectorized the thing you would see a huge boost :-) . And if you took the time to create manually compiled blas fftw etc for your specific architecture then its more boost. But since things cannot always be vectorized and matlab has a JIT it will always be the overall speed winner by a good percentage.

Currently matlab on my system is 30-35% faster at compiled library function calls like fft etc (possibly intel compilers used here) and about 999999% times faster when looping .
But i really like octave! It is a very important project- scilab is also really great.
Currently the speed winner at mathematical languages seems to be R, almost at the same level with matlab regarding speed.

dE_logics said...

Ubuntu packages are badly optimized, you might like to recompile it by hand with GCC's graphite infrastructure + a bit of experimental stuff like lto. Of course with the latest GCC.