Deoptimization: How YJIT Speeds Up Ruby by Slowing Down
summary
YJIT compiles Ruby methods to native code and claims 2× speed on Rails bench, with real production measurements showing 18% average / 33% peak storefront speedup at Shopify and deployments at other companies. It exposes a development mode (configure --enable-ydev and --dump), uses code patching and global invalidation for quick fallback, and Ruby 3.4 adds registerized locals, lazy frame push, singleton-class invalidation and a C-trace attribute to preserve backtraces — all intended to make aggressive optimizations safe in production.
AI-written summary · about
chapters (4)
- 0:00Introduction to YJIT
- 4:44Traditional deoptimizations
- 11:19New deoptimizations in Ruby 3.4
- 20:25C-trace attribute and conclusion
related talks
20mEvaluating YJIT’s Performance in a Production Context: A Pragmatic Approach
30mYJIT - Building a new JIT Compiler inside CRuby
17mYJIT: A Basic Block Versioning JIT Compiler
40mThe secret power of Ruby 2.6: JIT
45mClosing Keynote
28mZJIT: The future of Ruby performance
41mPerformance Improvement of Ruby 2.7 JIT in Real World
47mBetter Ruby
