The Method JIT Compiler for Ruby 2.6
summary
Method JIT for Ruby 2.6 compiles hot bytecode by translating YARV bytecode to C functions, invoking gcc/clang and loading them with bytecode-to-C with dlopen, running compilation on a worker thread while VM execution continues. Microbenchmarks show up to ~2× speed (some older LLVM tests hit ~5–7×), but real Rails workloads slow due to extra overheads: ~0.1 ms compile latency, lots of method-image mmap pages and I-cache stalls that increase cycles, frequent method-cache invalidations and longjmp effects. Workarounds implemented (compile-stop, fewer mmaps, inline +/arithmetic) reduce regressions but full inlining remains a work in progress.
AI-written summary · about
chapters (6)
- 0:00Introduction
- 2:01JIT compiler basics
- 11:23Performance issues with JIT
- 17:47Native method optimization
- 26:20Inline method optimization
- 32:21Q&A
related talks
40mThe secret power of Ruby 2.6: JIT
41mPerformance Improvement of Ruby 2.7 JIT in Real World
30mYJIT - Building a new JIT Compiler inside CRuby
32mExperiments in sharing Java VM technology with CRuby
57mRuby: 2020
20mBYOJ: Build your own JIT with Ruby
20mEvaluating YJIT’s Performance in a Production Context: A Pragmatic Approach
36mSome Assembly Required
