Invariants in my own Ruby: some things must never change
summary
An independent Ruby implementation builds a JIT almost entirely in Rust and now loads gems and Bundler, hitting about 350 FPS on OptCarrot versus ~70 FPS with the interpreter. Specialization rewrites core routines from Rust into Ruby and enables constant folding and inline-cache driven inlining; the system currently passes 57% of Ruby spec core tests. Guards, compile-time blocking of dangerous calls (eval, binding, tracepoint) and global-version-driven patch points handle invalidation. Live demo uses SDL2 and a custom FFmpeg binding and locks gameplay to 60 FPS.
AI-written summary · about
chapters (15)
- 0:00Introduction and background
- 1:34Monoruby JIT compiler overview
- 3:00Specialization and optimization
- 5:50Why Ruby is slow
- 8:16Constant folding technique
- 8:36Method call inline cache
- 11:25Dynamic features hinder optimization
- 12:07Monkey patching impact
- 13:10Local variable manipulation
- 14:55Binding and trace points
- 16:43Fighting Ruby's dynamic nature
- 17:48Guards and compile-time checks
- 18:57Patch points and binary patches
- 19:41Live demo introduction
- 21:53Conclusion and Q&A








