Lightning-Fast Method Calls with Ruby 4.1 ZJIT
summary
Proposes replacing per-call frame writes with driver frames in ZJIT, collapsing ~10–40 memory writes down to three by lazy-materializing frame metadata and repurposing the G_return slot. Prototype lives in ZJIT, uses a rewritten register allocator and is profiled with Linux perf on Rails benchmarks. Early results show ~2% end-to-end Rails speedup and ~5% on microbenchmarks, with a possible ~10% cycle reduction for JIT code; PC/IC protocol is implemented but stack and local-slot materialization remain unfinished and many side exits still hurt performance.
AI-written summary · about
chapters (12)
- 0:00Introduction to Ruby JIT
- 1:05What is Ruby JIT
- 3:54ZJIT vs YJIT performance
- 5:38Method call bottlenecks
- 9:52YJIT method call optimization
- 13:25ZJIT method call design
- 17:20Why stack writes are needed
- 20:27Introducing driver frames
- 23:14Challenges with driver frames
- 25:46Performance impact of driver frames
- 26:48Method inlining and future work
- 27:50Conclusion and next steps
related talks
28mZJIT: The future of Ruby performance
40mThe secret power of Ruby 2.6: JIT
41mPerformance Improvement of Ruby 2.7 JIT in Real World
20mEvaluating YJIT’s Performance in a Production Context: A Pragmatic Approach
30mYJIT - Building a new JIT Compiler inside CRuby
49mKeynote: Simple goal. Hard to accomplish
57mRuby: 2020
47mBetter Ruby
