Why is LuaJIT so good?

Mike Pall has talked about this in a few places:

As with every performant system, the answer in the end comes down to two things: algorithms and engineering. LuaJIT uses advanced compilation techniques, and it also has a very finely engineered implementation. For example, when the fancy compilation techniques can’t handle a piece of code, LuaJIT falls back to an very fast interpreter written in x86 assembly.

LuaJIT gets double points on the engineering aspect, because not only is LuaJIT itself well-engineered, but the Lua language itself has a simpler and more coherent design than Python and JavaScript. This makes it (marginally) easier for an implementation to provide consistently good performance.

Leave a Comment