Last updated 1 year ago by Benoit Dalozeruby
Nowadays, it seems every major Ruby implementation has a Just-In-Time (JIT) compiler. Recently, YARV-MJIT has been merged to MRI (CRuby) trunk. JRuby relies on the Java Virtual Machine JIT compilers, and TruffleRuby uses Graal.
One big challenge for JIT compilers is to be beneficial on short-running scripts. In general, JIT compilers are better for long-running applications like web servers.
John Hawthorn Recently wrote a blog post about using YARV-MJIT for a small Ruby script. In this post, I want to expand on that and analyze the performance of 43 short-running programs (from 0.04s to 20s). Quick startup and fast warmup are therefore important to achieve good results.
JRuby and TruffleRuby on JVM do not perform well on short-running programs as their startup alone gives them a big disadvantage. On the other hand, TruffleRuby on SubstrateVM has much better startup and warmup.
TruffleRuby can run on 2 different virtual machines: