lua-users home
lua-l archive

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


Dear Javier,

Thanks for your quick reply.

i'm curious; how does plain Lua compares to other scrip languages in your code?

The only other scripting language that I use is MATLAB, which has a JIT. When the JIT is succesful, MATLAB can run as fast as a compiled language like C or close. The JIT is generally succesful when you have loops like
for k=1:n v[k]=u[k+2]-2*u[k+1]+u[k]; end

Of course, this is not typical MATLAB code, which instead would be written
v=u(3:end)-2*u(2:end-1)+u(1:end-2)

However, I think on the modern MATLAB JIT, the first snippet is actually faster than the second, more MATLAB-ish one. O_o

The first snippet compiles to something which has C-like performance.

If you want a more detailed comparison, which unforunately excludes MATLAB, see

http://shootout.alioth.debian.org/gp4/benchmark.php?test=spectralnorm&lang=all

You will notice that right now, LISP does a lot better than Lua.

Cheers!

--
Sébastien Loisel