ZJIT: The future of Ruby performance
summary
YJIT already delivers 10–20% production speedups; ZJIT is a new method-level JIT merged into Ruby 4.0 that adds a Ruby-aware high-level IR (ZJIT HR) and runtime profiling via inserted zjit_ bytecode patch points. That lets the compiler do cross-basic-block optimizations like constant folding so 1 + 2 becomes return 3 compiled* and enables inlining, register allocation, dead-code elimination and platform codegen for x86/ARM64. ZJIT is experimental in 4.0, not yet production-ready; enable with -Denable-z and -Dzit and inspect with -Zg dump or the tzg fly dev visualizer.
AI-written summary · about
chapters (10)
- 0:00ZJIT and Ruby performance
- 1:07YJIT in Ruby 3.4
- 3:36ZJIT for Ruby 4.0
- 5:24Motivation for ZJIT
- 9:00Profiling and compiling Ruby
- 10:50ZG IR representation
- 15:13HIR optimization passes
- 20:38ZJIT compiler pipeline
- 21:45Visualizing HIR with tzg.fly.dev
- 23:15Ruby performance future
related talks
27mThe design and implementation of ZJIT & the next five years
30mYJIT - Building a new JIT Compiler inside CRuby
29mLightning-Fast Method Calls with Ruby 4.1 ZJIT
40mThe secret power of Ruby 2.6: JIT
20mEvaluating YJIT’s Performance in a Production Context: A Pragmatic Approach
17mYJIT: A Basic Block Versioning JIT Compiler
20mBYOJ: Build your own JIT with Ruby
29mOptimizing Production Performance with MRI JIT
