YJIT Benchmarks

Details for Benchmarks at 2021-12-14 19:11:03 GMT

YJIT metrics from the yjit-bench suite

Overall YJIT is 30.9% faster than interpreted CRuby!
On Railsbench specifically, YJIT is 27.6% 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 MJIT3.0 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 CRuby 3.1.0dev MJIT3.0 MJIT YJIT 3.1.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 MJIT3.0 MJIT YJIT binarytrees erubi erubi_rails fannkuchredux jekyll 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 CRuby 3.1.0dev MJIT3.0 MJIT YJIT 3.1.0dev binarytrees erubi erubi_rails fannkuchredux jekyll lee nbody optcarrot rubykon geomean*
Memory usage of each Ruby implementation relative to the baseline CRuby measurement. Lower is better.

Performance on MicroBenchmarks

Speed of each Ruby implementation relative to the baseline CRuby measurement. Higher is better.

Memory Usage on MicroBenchmarks

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 MJIT3.0 (ms) MJIT3.0 RSD MJIT (ms) MJIT RSD YJIT (ms) YJIT RSD MJIT3.0 spd MJIT3.0 spd RSD MJIT spd MJIT spd RSD YJIT spd YJIT spd RSD % in YJIT
activerecord 141.7 0.31% 158.5 0.70% 174.7 5.45% 106.6 0.45% 0.89x 0.77% 0.81x 5.46% 1.33x 0.55% 81.84%
hexapdf 2808.3 0.89% 2524.7 1.03% 2157.7 1.98% 1.11x 1.36% 1.30x 2.18% 74.81%
liquid-render 171.5 1.25% 158.1 2.25% 159.5 5.65% 114.9 2.14% 1.08x 2.58% 1.08x 5.79% 1.49x 2.48% 84.87%
mail 161.0 0.20% 148.1 0.42% 159.0 1.94% 142.6 0.24% 1.09x 0.47% 1.01x 1.95% 1.13x 0.32% 98.32%
psych-load 2225.6 0.18% 1912.3 0.58% 1835.9 0.17% 1648.4 0.31% 1.16x 0.61% 1.21x 0.25% 1.35x 0.36% 82.03%
railsbench 2614.0 1.05% 2885.2 1.09% 2996.0 2.71% 2048.0 1.44% 0.91x 1.51% 0.87x 2.91% 1.28x 1.78% 81.71%
binarytrees 372.9 0.07% 231.6 0.13% 254.8 0.24% 286.1 0.15% 1.61x 0.15% 1.46x 0.25% 1.30x 0.17% 84.27%
erubi 410.2 0.85% 403.5 1.18% 380.2 0.50% 410.9 0.61% 1.02x 1.45% 1.08x 0.99% 1.00x 1.05% 5.62%
erubi_rails 37.9 2.77% 47.1 8.62% 42.3 5.87% 32.5 6.89% 0.81x 9.05% 0.90x 6.49% 1.17x 7.43% 82.86%
fannkuchredux 5802.2 0.09% 3965.9 0.41% 5875.7 0.22% 5709.1 0.36% 1.46x 0.42% 0.99x 0.24% 1.02x 0.37% 0.01%
jekyll 8431.7 1.56% 7965.5 3.56% 8256.4 3.89% 7436.8 3.17% 1.06x 3.89% 1.02x 4.19% 1.13x 3.53% 82.34%
lee 1037.1 0.98% 946.5 0.58% 840.8 1.23% 748.8 1.66% 1.10x 1.14% 1.23x 1.57% 1.39x 1.93% 99.93%
nbody 103.7 0.08% 60.6 0.55% 58.2 0.07% 74.7 0.08% 1.71x 0.56% 1.78x 0.11% 1.39x 0.11% 100.00%
optcarrot 5116.5 0.44% 2228.7 0.56% 2148.9 0.61% 3098.3 0.56% 2.30x 0.71% 2.38x 0.75% 1.65x 0.72% 96.13%
rubykon 10641.1 0.77% 6413.4 0.42% 6751.4 0.63% 5574.2 0.49% 1.66x 0.88% 1.58x 0.99% 1.91x 0.91% 99.85%
30k_ifelse 2408.3 0.09% 2172.3 0.19% 3731.1 5.32% 318.3 0.10% 1.11x 0.20% 0.65x 5.32% 7.57x 0.13% 100.00%
30k_methods 6419.9 0.01% 5833.2 0.31% 7264.0 0.03% 745.5 0.08% 1.10x 0.31% 0.88x 0.03% 8.61x 0.08% 100.00%
cfunc_itself 93.3 0.22% 62.9 0.27% 64.0 0.11% 40.8 0.26% 1.48x 0.35% 1.46x 0.25% 2.28x 0.34% 100.00%
fib 219.0 0.06% 62.4 0.15% 62.2 0.04% 52.1 0.24% 3.51x 0.16% 3.52x 0.07% 4.20x 0.25% 100.00%
getivar 88.8 0.09% 90.2 0.18% 90.4 0.07% 35.5 0.02% 0.98x 0.20% 0.98x 0.11% 2.51x 0.10% 98.94%
keyword_args 244.6 0.06% 185.2 0.05% 188.5 0.04% 45.7 0.30% 1.32x 0.08% 1.30x 0.07% 5.35x 0.30% 100.00%
respond_to 233.4 0.41% 188.8 0.61% 206.2 0.60% 154.5 0.12% 1.24x 0.73% 1.13x 0.73% 1.51x 0.42% 100.00%
setivar 64.2 0.48% 68.1 0.12% 64.2 0.49% 39.3 0.08% 0.94x 0.49% 1.00x 0.68% 1.63x 0.49% 98.31%

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.1.0dev (2021-12-14T17:33:17Z master 397a509b6d) +YJIT [x86_64-linux]
Tested Ruby version for Ruby latest MJIT: ruby 3.1.0dev (2021-12-14T17:33:17Z master 397a509b6d) +MJIT [x86_64-linux]
Tested Ruby version for Ruby 3.0 MJIT: ruby 3.0.0p0 (2020-12-25 revision 95aff21468) +JIT [x86_64-linux]
For many older releases we got much better results with released MJIT 3.0 than latest prerelease, so we compared against both.

Benchmark Memory Usage Details

Number of Iterations and Warmups Tested

bench No JIT warmups No JIT iters MJIT3.0 warmups MJIT3.0 iters MJIT warmups MJIT iters YJIT warmups YJIT iters
activerecord 5 186 20 186 75 186 20 186
hexapdf 5 15 20 15 20 15
liquid-render 5 175 20 175 75 175 20 175
mail 5 141 20 141 75 141 20 141
psych-load 5 15 20 15 75 15 20 15
railsbench 5 15 20 15 75 15 20 15
binarytrees 5 87 20 87 75 87 20 87
erubi 5 52 20 52 75 52 20 52
erubi_rails 5 635 20 635 75 635 20 635
fannkuchredux 5 15 20 15 53 15 20 15
jekyll 5 15 20 15 36 15 20 15
lee 5 26 20 26 75 26 20 26
nbody 5 342 20 342 75 342 20 342
optcarrot 5 15 20 15 75 15 20 15
rubykon 5 15 20 15 44 15 20 15
30k_ifelse 5 65 20 65 75 65 20 65
30k_methods 5 27 20 27 43 27 20 27
cfunc_itself 5 503 20 503 75 503 20 503
fib 5 382 20 382 75 382 20 382
getivar 5 563 20 563 75 563 20 563
keyword_args 5 439 20 439 75 439 20 439
respond_to 5 124 20 124 75 124 20 124
setivar 5 479 20 479 75 479 20 479

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) 990314 757127 185 1194 0 0% 0 0 0
hexapdf (click) 1096106 893222 595 7999 614 7% 0 0 321
liquid-render (click) 490437 387898 143 1418 95 6% 0 0 1
mail (click) 892714 666318 325 5428 124 2% 0 0 39
psych-load (click) 312737 246741 57 435 1 0% 0 0 0
railsbench (click) 2519906 1909833 1295 9287 263 2% 0 0 26
binarytrees (click) 164531 127410 9 49 0 0% 0 0 0
erubi (click) 291041 229536 8 35 0 0% 0 0 0
erubi_rails (click) 2417634 1755060 260 1959 16 0% 0 0 3
fannkuchredux (click) 180531 139420 6 203 0 0% 0 0 0
jekyll (click) 1878314 1511934 336 3751 185 4% 0 0 0
lee (click) 348961 275343 43 557 66 11% 0 0 12
nbody (click) 173939 134611 8 149 0 0% 0 0 0
optcarrot (click) 502771 440147 196 3567 20 0% 0 0 0
rubykon (click) 306675 247957 138 1532 1 0% 0 0 0
30k_ifelse (click) 5553651 4347734 9261 57795 0 0% 0 0 0
30k_methods (click) 2174643 1659456 5780 19392 0 0% 0 0 0
cfunc_itself (click) 163123 126039 6 40 0 0% 0 0 0
fib (click) 161587 125647 6 29 0 0% 0 0 0
getivar (click) 163315 128158 6 56 0 0% 0 0 0
keyword_args (click) 163955 126680 7 42 0 0% 0 0 0
respond_to (click) 165235 127493 6 55 0 0% 0 0 0
setivar (click) 163251 126682 6 29 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.