4 ms·
I keep wanting to try it, too. But Lua + LuaJIT is so good that I find I never really need that last ninety-ninth percentile speedup. One of the things that I
by gregholmberg 15y ago
I keep wanting to try it, too. But Lua + LuaJIT is so good that I find I never really need that last ninety-ninth percentile speedup.
One of the things that I have found marvelous and counterintuitive about LuaJIT is Mike Pall's recurring warning to unlearn optimization idioms you might have picked up to accelerate standard Lua (which is already quite fast).
For example, the Lua language has a keyword 'local' to give you a shortcut optimization for identifier lookups in the global namespace. Using a local alias for a global function in a tight loop inside a standard Lua program can and often does result in a nice, juicy speedup.
LuaJIT, however, has highly optimized heuristics for i386, x86_64 and PPC ASM that will perform far better optimizations for you if you leave your clever aliasing out and just run a naive, plain vanilla Lua version. See [0]:"No, please don't do this."
He has also provided a new mechanism to dynamically wire C libraries and ad-hoc data structures directly into the LuaJIT runtime [1].
If there is scope for me to use assembler in this ecosystem somewhere, I can't see it yet. :)
[0] http://lua-users.org/lists/lua-l/2011-01/msg00978.html http://lua-users.org/lists/lua-l/2011-01/msg00978.html
[1] http://lua-users.org/lists/lua-l/2011-02/msg00455.html http://lua-users.org/lists/lua-l/2011-02/msg00455.html
- justincormack 15y agoMike did say on the list that he was considering at some point adding the ability to natively mix assembler code into Lua, that might give you an opportunity!