The magic of making Lua so fast is seriously underrated. I’m fascinated why Lua in particular seems to be so amenable to speedups vs, say, Python bytecode or even Elisp bytecode.
Never did program much in Lua but really enjoyed the parts where they describe the virtual machine and instruction set.
EDIT:
Link to the paper I mean https://www.lua.org/doc/jucs05.pdf
For a layman like myself this is very approachable. Again I cannot think of another VM language that has anything this small and well documented.
The other person he talks with is Andreas Gal and they talk about trace trees and method vs tracing jits.
Another issue with Python is that the language semantics are much more subtle. This is an excellent talk that shows how even operations that appear simple in Python can be much more complex than they appear: https://youtu.be/qCGofLIzX6g
https://www.freelists.org/post/luajit/How-does-LuaJITs-trace...
Elisp bytecode now has a compiler using libgccjit, in Emacs 28.
LuaJIT simply did a lot of heavy lifting, implementing a full blown compiler with register allocation and all of that. Lua wasn't special that way. Rather, the Python devs didn't care that much about speed, and Python has the baked in notion that Python programs are a tree of nested dictionaries. Thus, there is only so much performance that could be wrung out of PyPy. But it still helps a lot.
Python 3 was of course a tragedy. If they were going to break stuff at all, they could have made some of that dynamicity optional (few programs use it). Then PyPy could have been the reference implementation and it would be crazy fast, eliminate the GIL, and so on. Just like Lisp implementations have done for 50+ years.