

Given the level of risk involved with swapping out YARV for RTL, the Ruby team decided to move forward with Kokubun's approach, and today that work finally becomes available in Ruby 2.6 with the addition of a -jit option. It's not still so fast yet (especially it's performing badly with Rails for now), but we have much time to improve it until Ruby 2.6 (or 3.0) release. I've just committed the initial JIT compiler for Ruby. As you might deduce from the name, Kokubun's JIT implementation made use of the existing YARV instructions in Ruby, rather than replacing them with RTL as in Vlad's proposal. Vlad's MJIT proposal also included a significant change to the way Ruby runs your code: replacing the existing intermediate representation (IR) known as YARV with another easier to optimize IR called RTL.Īlongside Vlad's work on MJIT another prolific Rubyist named Takashi Kokubun (Ruby committer, maintainer of ERB and HAML) began developing a more conservative JIT called YARV-MJIT. For some additional context around that proposal, and a deeper understanding of JIT compilers and why they're popular, you might enjoy this interview we conducted with Vlad directly after he left the stage in Hiroshima: MJIT: A Method-based Just-In-Time Compiler for Ruby. If you've been following along with the Ruby team's progress you know that Vladimir Makarov first proposed a method-based JIT (MJIT) for Ruby at RubyKaigi 2017.

This would be an excellent time to install New Relic if you haven't already. Please think carefully before running anything in production with the JIT enabled, and make sure you have a plan in place to measure the performance of your applications. Note: Using heroku config to specify RUBYOPT currently does not work, but will be supported soon Make sure you add the -jit flag to your Procfile for any Ruby processes: web: ruby -jit jit_test.rbĪlternatively you can set an environment variable for your application to use the JIT: web: RUBYOPT=-jit rails server You can start using the JIT with your Heroku applications today, just add Ruby 2.6 to your Gemfile: source '' We'd also like to thank fellow Herokai Nobuyoshi Nakada for his effort making sure the new JIT works well with all of the officially supported compilers: GCC, Clang and Microsoft Visual C++. Just-In-Time compilation requires Ruby to spin up a compiler process on startup, and we're proud to say that this feature is supported today on Heroku thanks to the diligent efforts of our very own Richard Schneeman. The Ruby committers have again continued their annual holiday tradition of gifting us a new Ruby version: Ruby 2.6 was released today, including the long awaited Just-In-Time (JIT) compiler that the Ruby team has been working on for more than a year. Posted by Jonan Scheffler December 25, 2018
