YJIT Benchmarks

Details for Benchmarks at 2024-01-21 06:08:17 GMT

YJIT metrics from the yjit-bench suite using Ruby 366b14c0cd.

Using the geomean of the headline benchmarks for x86 YJIT 3.4.0dev is
  • 62.3% faster than CRuby 3.4.0dev
On railsbench it is
  • 67.7% faster than CRuby 3.4.0dev

Performance on Headline Benchmarks

Select Platform
0.0 0.5 1.0 1.5 2.0 CRuby 3.4.0dev YJIT 3.4.0dev activerecord chunky-png erubi-rails hexapdf liquid-c liquid-compile liquid-render lobsters mail psych-load railsbench rubocop ruby-lsp sequel geomean* 2.00 1.68 1.87 1.73 1.43 1.49 2.49 1.52 1.43 1.45 1.68 1.75 1.23 1.35 1.62
Speed of each Ruby implementation relative to the baseline CRuby measurement. Higher is better.

Memory Usage on Headline Benchmarks

Select Platform
0.0 0.2 0.4 0.6 0.8 1.0 1.2 1.4 1.6 CRuby 3.4.0dev YJIT 3.4.0dev activerecord chunky-png erubi-rails hexapdf liquid-c liquid-compile liquid-render lobsters mail psych-load railsbench rubocop ruby-lsp sequel geomean* 1.11 1.12 1.06 1.77 1.10 1.17 1.13 1.15 1.05 1.06 1.16 1.35 0.99 1.09 1.15
Memory usage of each Ruby implementation relative to the baseline CRuby measurement. Lower is better.

Performance on Other Benchmarks

Select Platform
0.0 0.5 1.0 1.5 2.0 2.5 3.0 3.5 CRuby 3.4.0dev YJIT 3.4.0dev binarytrees blurhash erubi etanni fannkuchredux fluentd graphql graphql-native lee matmul nbody nqueens optcarrot rack ruby-json rubykon sudoku tinygql geomean* 2.06 1.91 1.21 1.15 3.05 1.09 1.21 1.12 1.44 1.59 1.85 0.97 3.69 1.24 1.15 1.97 2.68 1.86 1.61
Speed of each Ruby implementation relative to the baseline CRuby measurement. Higher is better.

Memory Usage on Other Benchmarks

Select Platform
0.0 0.2 0.4 0.6 0.8 1.0 CRuby 3.4.0dev YJIT 3.4.0dev binarytrees blurhash erubi etanni fannkuchredux fluentd graphql graphql-native lee matmul nbody nqueens optcarrot rack ruby-json rubykon sudoku tinygql geomean* 1.01 1.02 1.06 1.01 1.01 1.04 1.08 1.07 1.06 1.01 1.01 1.01 1.09 1.06 1.01 1.05 1.02 1.07 1.04
Memory usage of each Ruby implementation relative to the baseline CRuby measurement. Lower is better.

Performance on MicroBenchmarks

Select Platform
0.0 5.0 10.0 15.0 20.0 CRuby 3.4.0dev YJIT 3.4.0dev 30k_ifelse 30k_methods cfunc_itself fib getivar keyword_args respond_to setivar setivar_object setivar_young str_concat throw geomean* 6.77 8.03 4.91 5.25 6.49 8.25 22.79 6.37 2.29 2.47 1.82 1.27 4.78
Speed of each Ruby implementation relative to the baseline CRuby measurement. Higher is better.

Memory Usage on MicroBenchmarks

Select Platform
0.0 0.2 0.4 0.6 0.8 1.0 1.2 1.4 CRuby 3.4.0dev YJIT 3.4.0dev 30k_ifelse 30k_methods cfunc_itself fib getivar keyword_args respond_to setivar setivar_object setivar_young str_concat throw geomean* 1.51 1.19 1.01 1.01 1.01 1.01 1.01 1.01 1.01 1.01 1.38 1.01 1.09
Memory usage of each Ruby implementation relative to the baseline CRuby measurement. Lower is better.

Want Raw Graphs and CSV?

Benchmarks Speed Details

Select Platform
bench CRuby 3.4.0dev (ms) CRuby 3.4.0dev RSD YJIT 3.4.0dev (ms) YJIT 3.4.0dev RSD YJIT 3.4.0dev spd YJIT 3.4.0dev spd RSD % in YJIT
activerecord 81.8 0.39% 40.8 0.63% 2.00x 0.74% 99.95%
chunky-png 1099.0 0.13% 653.3 0.30% 1.68x 0.33% 100.00%
erubi-rails 2628.2 0.17% 1404.7 0.19% 1.87x 0.26% 99.93%
hexapdf 3537.4 0.97% 2045.7 1.54% 1.73x 1.82% 93.01%
liquid-c 81.5 0.60% 56.9 0.79% 1.43x 0.99% 99.74%
liquid-compile 84.1 0.49% 56.3 5.07% 1.49x 5.09% 99.96%
liquid-render 201.2 0.29% 80.9 0.60% 2.49x 0.66% 99.92%
lobsters 1274.8 0.72% 840.1 1.26% 1.52x 1.45% 99.55%
mail 176.0 0.31% 122.7 0.38% 1.43x 0.49% 99.90%
psych-load 2774.6 0.04% 1917.8 0.06% 1.45x 0.07% 100.00%
railsbench 2812.1 0.08% 1677.3 0.19% 1.68x 0.21% 99.74%
rubocop 201.7 0.88% 115.5 1.32% 1.75x 1.59% 93.83%
ruby-lsp 138.6 3.78% 113.0 1.45% 1.23x 4.05% 99.02%
sequel 89.7 0.41% 66.6 0.45% 1.35x 0.60% 99.91%
binarytrees 492.4 0.10% 239.1 0.18% 2.06x 0.21% 100.00%
blurhash 433.2 0.05% 226.3 0.11% 1.91x 0.12% 100.00%
erubi 324.0 0.13% 267.3 0.13% 1.21x 0.18% 99.98%
etanni 449.4 0.08% 390.7 0.07% 1.15x 0.11% 99.98%
fannkuchredux 2561.8 0.71% 841.1 0.04% 3.05x 0.71% 90.57%
fluentd 2628.5 0.62% 2400.9 0.66% 1.09x 0.91% 99.99%
graphql 4267.2 0.05% 3533.7 0.03% 1.21x 0.06% 99.75%
graphql-native 659.5 0.06% 589.9 0.08% 1.12x 0.10% 99.97%
lee 1440.7 0.97% 997.9 1.39% 1.44x 1.70% 99.98%
matmul 2033.1 0.05% 1281.3 0.10% 1.59x 0.11% 99.84%
nbody 140.9 0.03% 76.3 0.03% 1.85x 0.04% 99.94%
nqueens 273.4 0.05% 281.6 0.10% 0.97x 0.11% 0.02%
optcarrot 7548.9 0.57% 2043.1 0.65% 3.69x 0.86% 99.50%
rack 136.9 0.34% 110.0 0.38% 1.24x 0.51% 99.71%
ruby-json 4025.0 0.03% 3494.2 0.11% 1.15x 0.11% 99.99%
rubykon 13373.4 0.66% 6801.1 1.99% 1.97x 2.10% 99.95%
sudoku 2150.1 0.03% 801.2 0.03% 2.68x 0.04% 99.89%
tinygql 891.7 0.10% 479.1 0.11% 1.86x 0.15% 99.99%
30k_ifelse 2442.5 0.06% 360.7 0.05% 6.77x 0.08% 99.99%
30k_methods 6691.7 0.02% 833.8 0.02% 8.03x 0.03% 99.99%
cfunc_itself 118.9 0.25% 24.2 0.05% 4.91x 0.25% 99.35%
fib 251.5 0.04% 47.9 0.18% 5.25x 0.19% 100.00%
getivar 138.1 0.03% 21.3 0.84% 6.49x 0.84% 97.87%
keyword_args 309.4 0.05% 37.5 0.11% 8.25x 0.12% 99.58%
respond_to 317.1 0.47% 13.9 0.76% 22.79x 0.89% 99.72%
setivar 76.4 0.10% 12.0 0.06% 6.37x 0.11% 98.74%
setivar_object 128.7 16.80% 56.1 40.14% 2.29x 43.51% 94.37%
setivar_young 123.2 10.84% 49.9 26.45% 2.47x 28.58% 94.94%
str_concat 90.4 0.76% 49.6 1.67% 1.82x 1.84% 99.97%
throw 29.5 0.28% 23.2 0.38% 1.27x 0.47% 99.99%

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.
Our benchmark-runner and reporting code is in the yjit-metrics Github repo.

Tested Ruby version for development CRuby and YJIT: ruby 3.4.0dev (2024-01-20T15:27:19Z :detached: 366b14c0cd) +YJIT [x86_64-linux]

Benchmark Memory Usage Details

Select Platform

Number of Iterations and Warmups Tested

bench CRuby 3.4.0dev warmups CRuby 3.4.0dev iters YJIT 3.4.0dev warmups YJIT 3.4.0dev iters
activerecord 30 486 30 486
chunky-png 30 30 30 30
erubi-rails 30 15 30 15
hexapdf 30 15 30 15
liquid-c 30 351 30 351
liquid-compile 30 355 30 355
liquid-render 30 247 30 247
lobsters 30 23 30 23
mail 30 163 30 163
psych-load 30 15 30 15
railsbench 30 15 30 15
rubocop 30 173 30 173
ruby-lsp 30 177 30 177
sequel 30 301 30 301
binarytrees 30 83 30 83
blurhash 30 88 30 88
erubi 30 75 30 75
etanni 30 51 30 51
fannkuchredux 30 23 30 23
fluentd 30 15 30 15
graphql 30 15 30 15
graphql-native 30 33 30 33
lee 30 20 30 20
matmul 30 15 30 15
nbody 30 261 30 261
nqueens 30 74 30 74
optcarrot 30 15 30 15
rack 30 181 30 181
ruby-json 30 15 30 15
rubykon 30 15 30 15
sudoku 30 24 30 24
tinygql 30 41 30 41
30k_ifelse 30 55 30 55
30k_methods 30 23 30 23
cfunc_itself 30 827 30 827
fib 30 417 30 417
getivar 30 941 30 941
keyword_args 30 533 30 533
respond_to 30 1437 30 1437
setivar 30 1668 30 1668
setivar_object 30 357 30 357
setivar_young 30 400 30 400
str_concat 30 402 30 402
throw 30 862 30 862

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 Compile Time MS
activerecord (click) 756846 683211 50 531 3 0% 0 0 0 15.959755
chunky-png (click) 310100 288796 87 1076 1 0% 0 0 0 32.046372
erubi-rails (click) 1629839 1433206 287 2907 1 0% 0 0 0 82.814369
hexapdf (click) 1349935 1149807 597 12270 36 0% 0 0 0 361.316314
liquid-c (click) 492375 435072 120 1701 5 0% 0 0 0 47.118486
liquid-compile (click) 417136 351217 151 2024 2 0% 0 0 0 61.960584
liquid-render (click) 586493 487443 143 2189 8 0% 0 0 0 61.326934
lobsters (click) 7561414 6421284 3145 49007 70 0% 0 0 0 1657.365157
mail (click) 688461 609434 345 4770 12 0% 0 0 0 140.812715
psych-load (click) 273257 248663 65 626 3 0% 0 0 0 19.774272
railsbench (click) 2480386 2173608 1357 12477 19 0% 0 0 0 367.565054
rubocop (click) 4882342 4183810 2898 43716 93 0% 4 0 0 1324.069636
ruby-lsp (click) 621251 554775 159 2741 14 0% 0 0 0 78.024479
sequel (click) 464924 417241 16 118 0 0% 0 0 0 4.214277
binarytrees (click) 9291 8120 11 75 0 0% 0 0 0 2.978365
blurhash (click) 51326 46923 32 426 1 0% 0 0 0 14.829301
erubi (click) 247031 233850 10 96 0 0% 0 0 0 3.30978
etanni (click) 30527 20735 12 92 0 0% 0 0 0 3.147448
fannkuchredux (click) 25131 18619 9 260 0 0% 0 0 0 7.971908
fluentd (click) 351719 318483 12 104 0 0% 0 0 0 3.356654
graphql (click) 417474 344794 70 656 0 0% 0 0 0 20.162695
graphql-native (click) 384377 322725 42 261 0 0% 0 0 0 8.637969
lee (click) 288911 257450 49 689 0 0% 0 0 0 22.03538
matmul (click) 12823 4423 12 123 0 0% 0 0 0 4.236016
nbody (click) 18205 16926 11 188 0 0% 0 0 0 5.550262
nqueens (click) 16593 18031 10 175 0 0% 0 0 0 5.398719
optcarrot (click) 304524 229410 197 4254 33 0% 0 0 0 100.850346
rack (click) 246908 230077 31 302 0 0% 0 0 0 8.810741
ruby-json (click) 27523 24999 12 203 0 0% 0 0 0 6.17451
rubykon (click) 127589 92671 144 1462 3 0% 0 0 0 41.373262
sudoku (click) 45221 36695 10 492 0 0% 0 0 0 14.885605
tinygql (click) 285812 253353 63 780 5 0% 0 0 0 22.512274
30k_ifelse (click) 4909613 4374725 9264 50816 0 0% 0 0 0 1391.467188
30k_methods (click) 1850440 1594390 5782 19372 0 0% 0 0 0 498.061902
cfunc_itself (click) 7728 6775 9 72 0 0% 0 0 0 2.390737
fib (click) 5044 5012 8 49 0 0% 0 0 0 1.83402
getivar (click) 6179 6402 8 74 0 0% 0 0 0 2.276904
keyword_args (click) 8341 6984 10 74 0 0% 0 0 0 2.604205
respond_to (click) 8471 8395 9 87 0 0% 0 0 0 2.80719
setivar (click) 5330 4983 8 54 0 0% 0 0 0 1.852723
setivar_object (click) 5668 5003 8 54 0 0% 0 0 0 1.897292
setivar_young (click) 6435 5792 9 62 0 0% 0 0 0 2.22168
str_concat (click) 8168 7817 11 88 0 0% 0 0 0 2.883792
throw (click) 7723 6444 10 69 0 0% 0 0 0 2.345917

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.