开发者

Is LuaJIT really faster than every other JIT-ed dynamic languages? [closed]

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely so开发者_StackOverflowlicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance. Closed 9 years ago.

According to the computer language benchmark game, the LuaJIT implementation seems to beat every other JIT-ed dynamic language (V8, Tracemonkey, PLT Scheme, Erlang HIPE) by an order of magnitude.

I know that these benchmarks are not representative (as they say: "Which programming language implementations have the fastest benchmark programs?"), but this is still really impressive.

In practice, is it really the case? Someone have tested that Lua implementation?


There's a good discussion at Lambda the Ultimate. LuaJIT is very good.

Many people have reported impressive speedups on lua-l (the lua mailing list). The speedups are most impressive for pure Lua code; the trace compiler is not as effective when there are lots of calls to C functions in loadable library modules.


In my case (a game prototype development), I observed no performance improvement at all. I use lua for embedding, so there are lots of calls to C++ library functions. Even though main loop is in a lua script and all of the important logic is implemented in lua, the overall performance was determined by rendering engines and physics engines implemented in C++. The original lua is already fast enough for such applications.


I made an experiment with the lesson learned here: http://www.sampalib.org/luajit2.0_tunning.html Some data are not that valid anymore ( maxmcode=1024 is enough ), but luajit brings a robust improvement on a 600 lines of code pure Lua script (no C call to hit perfs...) that is not a large scale application nor an embedded use case but much more than the benchmarks.


The performance of JIT depends on two things: performance of original scripting language, and the performance of the compiler.

Compiler is a pretty mature technique and most JIT compiler have comparable performance. However, lua itself, i.e. lua-without-JIT, is probably one of the fastest scripting language.

lua is faster than Java-without-JIT. lua is faster than Javascript-without-JIT. lua is faster than most-scripting-languages-without-JIT.

so,

lua-JIT is faster than Java-with-JIT (the sun Java), lua-JIT is faster than V8 (Javascript-with-JIT), etc, ...

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜