YJIT Benchmarks

Details for Benchmarks at 2022-06-08 19:15:45 GMT

YJIT metrics from the yjit-bench suite

Overall YJIT is 39.7% faster than interpreted CRuby!
On Railsbench specifically, YJIT is 34.7% faster than CRuby!

Performance on Headline Benchmarks

0.0 0.2 0.4 0.6 0.8 1.0 1.2 1.4 No JIT MJIT YJIT activerecord hexapdf liquid-render mail psych-load railsbench
Speed of each Ruby implementation relative to the baseline CRuby measurement. Higher is better.

Memory Usage on Headline Benchmarks

0.0 2.0 4.0 6.0 8.0 10.0 12.0 CRuby 3.2.0dev MJIT YJIT 3.2.0dev activerecord hexapdf liquid-render mail psych-load railsbench geomean*
Memory usage of each Ruby implementation relative to the baseline CRuby measurement. Lower is better.

Performance on Other Benchmarks

0.0 0.5 1.0 1.5 2.0 No JIT MJIT YJIT binarytrees chunky_png discourse erubi erubi_rails fannkuchredux lee nbody optcarrot rubykon
Speed of each Ruby implementation relative to the baseline CRuby measurement. Higher is better.

Memory Usage on Other Benchmarks

0.0 2.0 4.0 6.0 8.0 10.0 12.0 14.0 16.0 CRuby 3.2.0dev MJIT YJIT 3.2.0dev binarytrees chunky_png discourse erubi erubi_rails fannkuchredux lee nbody optcarrot rubykon geomean*
Memory usage of each Ruby implementation relative to the baseline CRuby measurement. Lower is better.

Performance on MicroBenchmarks

0.0 1.0 2.0 3.0 4.0 5.0 6.0 7.0 No JIT MJIT YJIT 30k_ifelse 30k_methods cfunc_itself fib getivar keyword_args respond_to setivar str_concat
Speed of each Ruby implementation relative to the baseline CRuby measurement. Higher is better.

Memory Usage on MicroBenchmarks

0.0 2.0 4.0 6.0 8.0 10.0 12.0 14.0 16.0 CRuby 3.2.0dev MJIT YJIT 3.2.0dev 30k_ifelse 30k_methods cfunc_itself fib getivar keyword_args respond_to setivar str_concat geomean*
Memory usage of each Ruby implementation relative to the baseline CRuby measurement. Lower is better.

Want Raw Graphs and CSV?

Benchmarks Speed Details

bench No JIT (ms) No JIT RSD MJIT (ms) MJIT RSD YJIT (ms) YJIT RSD MJIT spd MJIT spd RSD YJIT spd YJIT spd RSD % in YJIT
activerecord 160.0 1.10% 180.1 4.15% 104.9 0.51% 0.89x 4.29% 1.53x 1.21% 85.54%
hexapdf 3386.0 1.14% 2410.0 2.79% 1.40x 3.01% 82.53%
liquid-render 205.6 1.62% 195.8 1.32% 131.7 2.03% 1.05x 2.09% 1.56x 2.60% 85.70%
mail 188.6 0.09% 181.7 1.37% 162.8 0.37% 1.04x 1.37% 1.16x 0.38% 99.35%
psych-load 2759.1 1.22% 2359.8 0.11% 1935.6 0.03% 1.17x 1.22% 1.43x 1.22% 88.45%
railsbench 2824.6 0.96% 3110.9 1.16% 2097.5 1.27% 0.91x 1.50% 1.35x 1.59% 86.12%
binarytrees 511.1 0.23% 334.6 1.08% 400.0 0.13% 1.53x 1.11% 1.28x 0.27% 84.27%
chunky_png 1094.4 0.03% 846.7 0.41% 713.6 0.09% 1.29x 0.42% 1.53x 0.09% 99.95%
discourse 558.3 1.46% 586.0 1.99% 489.8 9.86% 0.95x 2.47% 1.14x 9.97% 73.53%
erubi 475.2 0.61% 441.6 0.77% 401.7 0.71% 1.08x 0.98% 1.18x 0.94% 100.00%
erubi_rails 28.4 2.92% 29.8 3.55% 20.4 3.78% 0.95x 4.60% 1.39x 4.78% 86.30%
fannkuchredux 8601.9 0.17% 5927.7 0.27% 8770.1 0.05% 1.45x 0.32% 0.98x 0.17% 0.02%
lee 1430.4 1.04% 1123.5 1.34% 1002.4 1.58% 1.27x 1.70% 1.43x 1.90% 99.97%
nbody 108.2 0.09% 62.8 0.07% 88.5 0.48% 1.72x 0.12% 1.22x 0.49% 100.00%
optcarrot 6495.8 0.44% 2619.9 0.63% 3713.6 0.57% 2.48x 0.77% 1.75x 0.72% 96.13%
rubykon 14065.5 2.63% 9782.3 3.77% 8306.9 3.69% 1.44x 4.59% 1.69x 4.53% 99.67%
30k_ifelse 2424.4 0.24% 3115.4 2.73% 359.3 0.19% 0.78x 2.74% 6.75x 0.30% 100.00%
30k_methods 6280.2 0.01% 9812.9 1.39% 878.2 0.06% 0.64x 1.39% 7.15x 0.06% 100.00%
cfunc_itself 126.0 0.11% 89.5 4.98% 50.7 0.89% 1.41x 4.98% 2.49x 0.90% 100.00%
fib 296.2 0.10% 80.2 0.43% 62.7 0.57% 3.69x 0.44% 4.72x 0.58% 100.00%
getivar 107.3 0.06% 25.7 61.53% 42.8 1.35% 4.17x 61.53% 2.51x 1.35% 99.23%
keyword_args 306.0 0.10% 220.7 0.31% 58.0 0.65% 1.39x 0.33% 5.27x 0.65% 100.00%
respond_to 317.0 0.78% 268.6 1.26% 206.7 0.42% 1.18x 1.48% 1.53x 0.88% 100.00%
setivar 73.9 0.26% 14.4 75.34% 73.2 0.48% 5.12x 75.35% 1.01x 0.55% 99.41%
str_concat 137.1 1.66% 102.3 1.58% 111.4 1.36% 1.34x 2.29% 1.23x 2.15% 99.98%

RSD is relative standard deviation - the standard deviation divided by the mean, expressed as a percentage.
% in YJIT is the percentage of instructions that complete in YJIT rather than exiting to the non-JITted interpreter. YJIT performs better when this is higher.
Speedup is relative to interpreted CRuby. So an "MJIT speedup" of 1.21x means MJIT runs at 1.21 times the iters/second of CRuby with JIT disabled.

You can find our benchmark code in the yjit-bench Github repo and the yjit-extra-benchmarks Github repo.
Our benchmark-runner and reporting code is in the yjit-metrics Github repo.

Tested Ruby version for YJIT and No-JIT: ruby 3.2.0dev (2022-06-08T17:49:00Z master da883af42a) +YJIT [x86_64-linux]
Tested Ruby version for Ruby latest MJIT: ruby 3.2.0dev (2022-06-08T17:49:00Z master da883af42a) +MJIT [x86_64-linux]

Benchmark Memory Usage Details

Number of Iterations and Warmups Tested

bench No JIT warmups No JIT iters MJIT warmups MJIT iters YJIT warmups YJIT iters
activerecord 5 190 75 190 20 190
hexapdf 5 15 20 15
liquid-render 5 149 75 149 20 149
mail 5 105 75 105 20 105
psych-load 5 15 75 15 20 15
railsbench 5 15 75 15 20 15
binarytrees 5 58 75 58 20 58
chunky_png 5 27 75 27 20 27
discourse 5 33 75 33 20 33
erubi 5 46 75 46 20 46
erubi_rails 5 782 75 782 20 782
fannkuchredux 5 15 51 15 20 15
lee 5 20 75 20 20 20
nbody 5 312 75 312 20 312
optcarrot 5 15 75 15 20 15
rubykon 5 15 30 15 20 15
30k_ifelse 5 55 75 55 20 55
30k_methods 5 22 30 22 20 22
cfunc_itself 5 393 75 393 20 393
fib 5 320 75 320 20 320
getivar 5 781 75 781 20 781
keyword_args 5 344 75 344 20 344
respond_to 5 94 75 94 20 94
setivar 5 1402 75 1402 20 1402
str_concat 5 188 75 188 20 188

Different Ruby configurations want different amounts of warmup. With no JIT, CRuby needs hardly any. YJIT and MJIT 3.0 both warm up quite quickly, while MJIT in 3.1 often slows down for a time as it compiles, after an unpredictable delay.

Benchmark YJIT Stats

Hover your cursor over the benchmark names for descriptions of each benchmark.

bench Exit Report Inline Outlined Comp iSeqs Comp Blocks Inval Inval Ratio Bind Alloc Bind Set Const Bumps
activerecord (click) 1012059 752974 131 1245 0 0% 0 0 0
hexapdf (click) 1120539 879294 683 7753 10 0% 0 0 0
liquid-render (click) 513947 394047 150 1633 2 0% 0 0 0
mail (click) 939483 678640 374 5796 15 0% 0 0 0
psych-load (click) 340379 255601 68 462 1 0% 0 0 0
railsbench (click) 2625179 1919663 1436 9877 16 0% 0 0 0
binarytrees (click) 174171 130445 13 58 0 0% 0 0 0
chunky_png (click) 384219 286711 88 1031 0 0% 0 0 0
discourse (click) 5925083 4400533 3195 25496 85 0% 2 0 0
erubi (click) 319643 242761 10 79 0 0% 0 0 0
erubi_rails (click) 1929755 1390820 300 1983 4 0% 0 0 0
fannkuchredux (click) 188251 141143 10 188 0 0% 0 0 0
lee (click) 378395 283827 58 622 0 0% 0 0 0
nbody (click) 183643 137646 12 158 0 0% 0 0 0
optcarrot (click) 514843 442895 207 3571 20 0% 0 0 0
rubykon (click) 317915 250695 145 1534 1 0% 0 0 0
30k_ifelse (click) 5561883 4349908 9265 57804 0 0% 0 0 0
30k_methods (click) 2177051 1658370 5784 19361 0 0% 0 0 0
cfunc_itself (click) 171355 128213 10 49 0 0% 0 0 0
fib (click) 171227 128682 10 38 0 0% 0 0 0
getivar (click) 173019 131193 10 65 0 0% 0 0 0
keyword_args (click) 173595 129715 11 51 0 0% 0 0 0
respond_to (click) 173467 129667 10 64 0 0% 0 0 0
setivar (click) 171547 128856 10 38 0 0% 0 0 0
str_concat (click) 172699 129784 12 62 0 0% 0 0 0

YJIT stats correspond to the YJIT stats exit report.

Note: currently, all stats are collected on x86_64, not ARM.

Raw JSON data files

All graphs and table data in this page comes from processing these data files, which come from benchmark runs.