/plushcap/analysis/cloudflare/more-consistent-luajit-performance

More consistent LuaJIT performance

What's this blog post about?

In this project, we aimed to improve LuaJIT's performance consistency by implementing separate counters for each loop and function in a program. We also started work on implementing a new garbage collector (GC) for LuaJIT based on Mike Pall's suggestion. We found that the original version of LuaJIT is highly non-deterministic, which can be confusing for users and create problems when estimating server provisioning. By implementing separate counters, we were able to make performance more consistent overall, particularly for larger programs. However, this change also delayed some loops from being traced, which disadvantaged small deterministic benchmarks where loops are highly stable. We also discovered that the odd performance in some programs was related to LuaJIT's Garbage Collector (GC). When we moved from the 32-bit to 64-bit GC, the problem seemed to go away. This led us to reevaluate LuaJIT's GC and start work on implementing a new one based partly on Tom's previous work and also that of Peter Cawley. In conclusion, while we did not achieve everything we wanted to in 12 months, we made significant progress towards improving LuaJIT's performance consistency and developing a new GC for it.

Company
Cloudflare

Date published
Dec. 12, 2018

Author(s)
Guest Author

Word count
2538

Hacker News points
None found.

Language
English


By Matt Makai. 2021-2024.