HerokuJonan SchefflerAnnouncement
Ruby 2.6 Released: Just-In-Time Compilation Is Here
Summary
Ruby 2.6 introduces an initial Just-In-Time (JIT) compiler, making the feature available through the --jit option and on Heroku. The implementation follows Takashi Kokubun’s YARV-MJIT approach, retaining Ruby’s existing YARV instructions instead of replacing them with the proposed RTL intermediate representation; it starts a compiler process at startup and supports GCC, Clang, and Microsoft Visual C++. On Heroku, applications can select Ruby 2.6 in the Gemfile and enable JIT through a Procfile flag or RUBYOPT, although setting RUBYOPT with heroku config is not yet supported. The optcarrot benchmark showed a reported 1.8x speed increase over Ruby 2.5, while Rails and Sidekiq were slower because compilation costs and roughly 2MB per compiled method create overhead. JIT compaction reduces memory use near the 1,000-method cache limit, but the source says further work is needed before JIT becomes the default.
Context
Ruby’s JIT work supports the broader Ruby 3×3 goal of tripling Ruby’s speed. The source notes that performance gains vary by workload: optcarrot improved, while Rails and Sidekiq became slower because compiling methods can cost more than interpreting them and consumes substantial memory.
Approach / What changed
Ruby 2.6 adopts Takashi Kokubun’s YARV-MJIT implementation, which keeps Ruby’s existing YARV instructions and adds a --jit option. Heroku applications can enable it through a Procfile flag or RUBYOPT. MJIT also combines compiled methods as the cache approaches its default limit of 1,000 methods.
Takeaways
Ruby 2.6’s JIT uses the existing YARV instruction set rather than replacing it with the proposed RTL intermediate representation.
The optcarrot benchmark showed a reported 1.8x speed increase over Ruby 2.5 with --jit, while Rails and Sidekiq experienced decreased performance.
Each compiled method initially consumes about 2MB of memory; JIT compaction reduces method size near the 1,000-method cache limit but does not yet make Rails faster.
Source and freshness
- Source
- heroku.com
- Published
- Added to Yomu
Summaries are generated from the original by a language model. Check the original before relying on it.
Keep reading
Related reading
The Good Stuff
Paid picks we use ourselves. Links carry a referral code — a subscription through one earns us a commission at no extra cost to you.
The best engineering reads, once a week
One useful email. Unsubscribe anytime.