[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: LuaJIT vs MATLAB benchmark
- From: David Kastrup <dak@...>
- Date: Fri, 06 Nov 2009 23:41:55 +0100
Leo Razoumov <email@example.com> writes:
> On 2009-11-06, Mike Pall <firstname.lastname@example.org> wrote:
>> Please post current benchmark results vs. Matlab, if you have any.
> For whatever it is worth below is a comparison of LuaJIT-1 versus
> MATLAB-7.8.0 (February 2009 release) for a scalar tight loop
> It seems that MATLAB Windows port is better optimized but it is still
> about 100 times slower than LuaJIT-1. The joke is that MATLAB has its
> own JIT since version 6.5 and JIT was enabled for these tests.
> Now you may ask how come that people put up with such a poor
> performance of the interpreter. The answer is multi-fold.
And mostly wrong.
Matlab is _known_ to suck at scalar code and nested loops. Nobody uses
it in that manner for serious number crunching. What you do is convert
your task into a matrix operation task. At times that takes quite a bit
of ingenuity. It helps that you can index a matric or vector using a
vector (and getting a vector), and the vectors of form a:b (a range) are
often optimized away into explicit code/loops.
There are tutorials and stuff around for maximizing Matlab performance.
And the main point is to avoid scalar operations.