lua-users home
lua-l archive

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

On 17 February 2011 15:50, Leo Razoumov <> wrote:
> As far as the MATLAB interpreter/JIT is concerned it is hopelessly
> slow so that using MATLAB in event-driven simulations that require
> explicit loops and lots of branching is PITA.

MATLAB's jit has its limitations (e.g., I don't think it can jit
through functions calls) but I could get quite a good speed up from it
with carefully written code.  For trivial code:

n = 5e4;
a = 0;
for i = 1:n,
  for j = 1:n,
    a = a + 1;

I get 9.30sec on my machine.  An equivalent Lua code takes 2.55sec.
So MATLAB is clearly not as good as luajit, but not as terrible as
some would like to make it.

> IMHO, the best thing that could happen to MATLAB is to switch to Lua,
> license Mike's LuaJIT and port their cool toolboxes to it.

Dream on.  That will never happen.  But one could write a bridge to
MATLAB, something like lupa for python.  With access to native data
types in MATLAB through FFI, that could be quite fast.