4 ms·
LuaJIT completely upended my view of what a JIT compiler could be. I always thought that JVM-like overheads were inevitable for high-performing JIT compilers.
by haberman 2y ago
LuaJIT completely upended my view of what a JIT compiler could be. I always thought that JVM-like overheads were inevitable for high-performing JIT compilers. When I saw how small and low-overhead LuaJIT is, I was blown away.
Here are some numbers:
Lines of code: OpenJDK HotSpot (1.4M), LuaJIT: (92k)
Binary size: OpenJDK HotSpot server/libjvm.so (24MB), LuaJIT: (576KB)
Time to run "Hello, World": OpenJDK HotSpot (64ms), LuaJIT (3ms) (the JVM has improved here, it used to take hundreds of milliseconds)
For me personally, LuaJIT's small size and low overheads set a new standard for what I expect from JIT compiled runtimes.
I also find its small code base makes it approachable to learn from. I won't say that reading the code is easy, but I at least have confidence that whenever I have a question about fast interpreters or JIT compiling techniques, I can find the relevant part of the LuaJIT code and study it. Larger code bases can feel so sprawling that it's hard to ever find the snippet of code that will answer a question.
- pjmlp 2y agoComparing apples to oranges, given what Lua and Java offer in features.
- canadianfella 2y ago[dead]