The secret power of Ruby 2.6: JIT
summary
Ruby 2.6’s MJIT is usable with --jit (or RUBYOPT="--jit") and can speed some workloads ~2.5× (Optcarrot to ~60 FPS) but also makes Rails/Sidekiq slower when it compiles many methods (reports around 10,000). MJIT spawns GCC worker processes, emits C, dlopen’s multi‑megabyte objects, and incurs 50–200 ms compile latency; default jit-max-cache 1000 triggers a costly compaction step. TracePoint disables JIT, and GC/waitpid contention can stall the main thread. Mitigations: reduce jit-max-cache, use JIT compaction/inline‑method patches, profile with benchmark_driver.
AI-written summary · about
chapters (15)
- 0:00Start
- 2:28History of Ruby implementation
- 4:33Let's benchmark Ruby 2.6 JIT
- 6:06How about other benchmarks?
- 6:29Today's topic JIT performance characteristics
- 7:02When there are many JIT-ed methods
- 7:54JIT by C compiler & dynamic loading
- 10:55JIT compaction
- 11:58CPU/memory resources for C compiler
- 12:28Locks on GC, waitpid, ...
- 15:581. Almost all methods
- 17:192. Basic operators on core classes
- 18:42Calling Ruby method
- 21:15Instance variable access
- 29:33Create a benchmark for Ruby 3x3?








