lua-users home
lua-l archive

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


On 1/29/2013 7:10 PM, cynthia powers wrote:
Can anyone point me to some good documentation on:
1. LuaJIT : intrinsics of luajit, advantages of using luaJIT, disadvantages etc..
2, llvm-lua: intrinsics, advantages/disadvantages.
What factors to look for while choosing one over the other.. etc.

LuaJIT, last time I checked, produced faster code, and it's very good at supporting Lua 5.1 and a good deal of 5.2. LuaJIT also has the FFI extensions that allow you to write code that interfaces to C libraries much faster than Lua, and in a way that can be optimized well; I can't comment on whether llvm-lua has similar support.

On speed and static compilation, the LuaJIT author (Mike Pall) commented that there are inherent challenges in statically compiling dynamic languages [0]. That thread also mentions that LuaJIT is about 2-3x faster than llvm-lua. Also consider that if you're going to allow evaluation of new code at runtime, then either it needs to be interpreted or you need to include the llvm-lua compiler in your product, and I am going to say llvm-lua is going to be MUCH bigger and heavier than LuaJIT.

llvm-lua used to have as a huge advantage "works on processors other than x86", but now that LuaJIT supports more platforms [1], that's less of an advantage. Still, if you need some obscure platform support, llvm-lua may be your only option. llvm-lua has been under active development as recently as last June, though, so it's possible that they've closed the optimization gap in the last three years. If it ended up ever getting faster than LuaJIT, I would have expected to see an announcement bragging about that, though -- and a quick search brings up nothing to that effect.

There's also a LuaJIT list [2], if you'd like to get Mike's current opinion or otherwise ask questions about LuaJIT, though I don't know if he's been keeping up with development of llvm-lua.

Given the serious speed advantage of LuaJIT combined with how light it is, I wouldn't even consider llvm-lua for my own uses. If I needed MORE speed than LuaJIT, and for whatever reason I didn't want to just use C++, I'd probably switch to a new language -- Google's "Go" [3] feels a bit like Lua to me, for instance, and it gets the benefits of predefined types, which can allow a static compiler to create well-optimized code.

Tim

[0] http://lua-users.org/lists/lua-l/2009-06/msg00071.html

[1] http://luajit.org/luajit.html

[2] http://www.freelists.org/list/luajit

[3] http://golang.org/