~/talk

Ruby the Hard Way: Writing Bytecode to Optimize Plain Ruby

Talkat RubyKaigi 2026 · 2026-04-22..04-24· [ruby, compilers-and-language-design]
slides:none on file

A toy optimizer gem called optimize gem decodes YARV binaries, rewrites instruction sequences and re-encodes them between Ruby’s dump and eval steps. The pipeline uses hand wrote a prompter and had Quad code build me a compiler, performs inlining, dead‑store elimination and constant folding, reduces cases from 24 instructions down to six, converges in three passes and yields ~1.85× speedups for one example. It’s pinned to a single Ruby minor, breaks tracepoints, coverage and reloading, and miscompiles if core operations are redefined.

AI-written summary · about

  1. 0:00Introduction and setup
  2. 3:48Ruby bytecode basics
  3. 16:16Building a toy optimizer
  4. 23:59Optimization pipeline in action
  5. 27:54Performance gains and limitations
  6. 30:46Why not use this in practice
  7. 32:33Conclusion and Q&A
~/search
type to search 6,249 conferences, 138,987 speakers and 185,172 talks
~/help
cmdctrl k
search every conference, speaker and series
/
focus the filter search
h
home
c
conferences
s
speakers
e
series
t
light / dark — the status bar button does the same
?
this help
esc
close this, then clear every filter — or just the search, while you are typing in it

Ignored while you are typing. Pages without a filter rail have no search to focus.