"LuaJIT's interpreter () beats V8's JIT compiler" - Mike Pall
lambda-the-ultimate.org
lambda-the-ultimate.org
require"c-gmp"(g, aux)
Implying that it is using the GNU Multiprecision Library for it's big integer support, whereas the JS code has:
load('/home/dunham/shootout/bench/Include/javascript/biginteger.js');
Which is apparently a big integer library implemented in javascript http://www-cs-students.stanford.edu/~tjw/jsbn/
In other words, in at least one of the tests a comparison is being made between javascript and C/C++, not javascript and Lua.
> For pidigits I'm comparing the pure JS and Lua programs, not the GMP bindings.
I'm comparing these two:
http://shootout.alioth.debian.org/u32/program.php?test=pidig...
http://shootout.alioth.debian.org/u32/program.php?test=pidig...
Both are written in pure Lua and JavaScript and do not use a C binding.
Which is using GMP, so maybe that particular link needs to be updated?
The Lua benchmark uses features Lua can use. JavaScript does not have that feature.
Go Rubinius!
The basic problem faced by a JS engine is that if it wants to be able to inline a function it has to be able to either:
* Prove that it knows everything that the function may do -- in effect this means you can't inline any functions that themselves call functions, or any functions that interact with any values you can't consider constant, or identify before you enter the inlined code; or
* Have the ability to at any point in time reconstruct the call stack, and all arguments correctly.
One of these choices is exceedingly limiting in what you can do, and the other is vastly complex.
Only the use of such a feature should trip the "do it the safe but slow way" switch. Maybe that's not possible here though, I don't know that much about compiler optimization.
edit: I'm not implying it's easy either, but if it's possible the V8 team has the skills to implement it.
LuaJIT keeps enough info around to go back to the interpreter at the moment anything goes different than previously traced -- I see no reason JS couldn't do the same.
That said to me lua seems a little bit like JavaScript's sane cousin.