Why LuaJIT's interpreter is written in assembly

  • Is LuaJIT still under active development? I thought the developer had walked away. With Torch also looking dead, that use case is gone, too. Roblox has their own Lua VM now.

    I love Lua and code in it almost every day for fun, but yeah I'm pretty sure LuaJIT is just "done" now?

  • Relevant:

    > > Threaded code should have better branch prediction behavior than a jump table with a single dispatch point

    > This is not the case anymore, at least for modern Intel processors. Starting with the Haswell micro-architecture, the indirect branch predictor got much better and a plain switch statement is just as fast as the "computed goto" equivalent. Be wary of any references about this that are from before 2013.

    https://news.ycombinator.com/item?id=15396761

  • That needs an 2011 tag.

  • I wonder if Clang can do better these days; I noticed that it seems to merge computed gotos to normal-looking control-flow (I suppose this is necessary for alias analysis).