Optimizing ruby core
summary
Implements a deoptimization engine in Ruby 2.4 that overwrites iseq bytecode in place (memcpy of an iseq_copy) to enable on‑the‑fly optimizations while preserving program counter and VM state. Uses a global VM timestamp to detect redefinitions, applies constant folding, send elimination and local variable elimination, and keeps the implementation pure C for portability. Benchmarks show many cases slightly slower but some workloads speed up dramatically (reported up to 400× and common gains around 10×); Rails shows no net win yet.
AI-written summary · about
chapters (26)
- 0:00Introduction
- 1:00Overview
- 1:28Fastest language
- 2:56Not optimized
- 3:41Variations
- 4:03Optimization
- 5:20Diagram
- 6:54Implementation
- 7:11Advantages
- 7:57Timestamp
- 8:16Implementation bitlong
- 9:19Implementation stackframe
- 9:45Summary
- 10:03Optimizations
- 11:28Inline implementation
- 13:09Not always possible
- 15:59Purity
- 17:50Vm
- 18:12Anson
- 19:02Assignments
- 19:36Libraries Analysis
- 20:29Summarize
- 21:01Benchmark
- 24:17Conclusion
- 24:41Future optimization
- 25:20Questions








