YJIT Benchmarks

Details for Benchmarks at 2024-05-11 19:42:45 GMT

YJIT metrics from the yjit-bench suite using Ruby 7e604a0263.

Using the geomean of the headline benchmarks for x86 YJIT 3.4.0dev is
  • 69.0% faster than CRuby 3.4.0dev
  • 9.6% faster than YJIT 3.3.1
On railsbench it is
  • 77.8% faster than CRuby 3.4.0dev
  • 6.7% faster than YJIT 3.3.1

Performance on Headline Benchmarks

0.0 0.5 1.0 1.5 2.0 2.5 CRuby 3.4.0dev YJIT 3.3.1 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.85 2.12 1.65 1.79 1.74 1.84 1.51 1.83 1.34 1.44 1.35 1.45 2.40 2.58 1.49 1.53 1.35 1.44 1.38 1.71 1.67 1.78 1.63 1.88 1.30 1.34 1.24 1.34 1.54 1.69
Speed of each Ruby implementation relative to the baseline CRuby measurement. Higher is better.

Memory Usage on Headline Benchmarks

0.0 0.2 0.4 0.6 0.8 1.0 1.2 1.4 1.6 1.8 CRuby 3.4.0dev YJIT 3.3.1 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.09 1.11 0.86 1.02 1.01 1.04 1.25 1.94 1.07 1.10 1.01 1.09 1.12 1.15 1.19 1.25 0.80 1.06 1.00 1.05 1.08 1.09 1.29 1.35 1.13 1.13 1.02 1.07 1.06 1.16
Memory usage of each Ruby implementation relative to the baseline CRuby measurement. Lower is better.

Performance on Other Benchmarks

0.0 1.0 2.0 3.0 4.0 CRuby 3.4.0dev YJIT 3.3.1 YJIT 3.4.0dev binarytrees blurhash erubi etanni fannkuchredux fluentd graphql graphql-native lee matmul nbody nqueens optcarrot protoboeuf rack ruby-json rubykon sudoku tinygql geomean* 1.74 2.17 2.04 2.29 1.14 1.24 2.09 1.08 2.49 2.97 0.96 1.08 1.13 1.22 1.01 1.12 1.20 1.44 1.68 1.81 2.21 2.28 1.02 4.02 3.11 3.54 2.90 3.87 1.67 1.80 1.09 1.17 1.92 2.13 2.54 2.90 1.77 1.83 1.66 1.91
Speed of each Ruby implementation relative to the baseline CRuby measurement. Higher is better.

Memory Usage on Other Benchmarks

0.0 0.2 0.4 0.6 0.8 1.0 CRuby 3.4.0dev YJIT 3.3.1 YJIT 3.4.0dev binarytrees blurhash erubi etanni fannkuchredux fluentd graphql graphql-native lee matmul nbody nqueens optcarrot protoboeuf rack ruby-json rubykon sudoku tinygql geomean* 0.91 1.04 0.97 1.01 1.00 1.04 0.95 1.01 0.96 1.01 0.99 1.08 1.06 1.07 1.01 1.06 0.92 1.04 0.98 1.00 0.96 1.01 0.95 1.05 1.01 1.09 0.91 1.18 1.01 1.06 0.97 1.01 1.01 0.97 0.97 1.01 0.99 1.06 0.97 1.04
Memory usage of each Ruby implementation relative to the baseline CRuby measurement. Lower is better.

Performance on MicroBenchmarks

0.0 5.0 10.0 15.0 20.0 CRuby 3.4.0dev YJIT 3.3.1 YJIT 3.4.0dev 30k_ifelse 30k_methods cfunc_itself fib getivar keyword_args respond_to ruby-xor setivar setivar_object setivar_young str_concat throw geomean* 7.03 7.03 8.16 8.09 4.15 4.56 6.30 6.32 5.00 5.36 7.65 10.02 17.57 21.87 2.61 3.84 6.29 9.52 2.53 2.92 2.80 2.88 1.89 1.81 1.23 1.21 4.46 5.03
Speed of each Ruby implementation relative to the baseline CRuby measurement. Higher is better.

Memory Usage on MicroBenchmarks

0.0 0.2 0.4 0.6 0.8 1.0 CRuby 3.4.0dev YJIT 3.3.1 YJIT 3.4.0dev 30k_ifelse 30k_methods cfunc_itself fib getivar keyword_args respond_to ruby-xor setivar setivar_object setivar_young str_concat throw geomean* 0.62 1.05 0.63 1.10 0.96 1.02 0.96 1.01 0.96 1.02 0.96 1.02 0.96 1.02 0.96 1.01 0.96 1.02 0.96 1.01 0.96 1.01 0.97 1.00 0.96 1.01 0.90 1.02
Memory usage of each Ruby implementation relative to the baseline CRuby measurement. Lower is better.

Want Raw Graphs and CSV?

Benchmarks Speed Details

bench CRuby 3.4.0dev (ms) CRuby 3.4.0dev RSD YJIT 3.3.1 (ms) YJIT 3.3.1 RSD YJIT 3.4.0dev (ms) YJIT 3.4.0dev RSD YJIT 3.3.1 spd YJIT 3.3.1 spd RSD YJIT 3.4.0dev spd YJIT 3.4.0dev spd RSD % in YJIT
activerecord 512.7 0.31% 277.3 0.40% 242.1 0.36% 1.85x 0.50% 2.12x 0.47% 99.93%
chunky-png 1134.0 0.21% 688.1 0.20% 635.1 0.25% 1.65x 0.29% 1.79x 0.32% 99.99%
erubi-rails 1909.1 0.28% 1095.3 0.22% 1039.5 0.40% 1.74x 0.35% 1.84x 0.49% 99.84%
hexapdf 3581.7 0.75% 2370.6 0.60% 1960.0 0.96% 1.51x 0.96% 1.83x 1.22% 98.88%
liquid-c 84.4 0.58% 62.8 0.83% 58.5 0.73% 1.34x 1.01% 1.44x 0.94% 99.75%
liquid-compile 86.3 0.42% 64.0 0.61% 59.7 1.77% 1.35x 0.74% 1.45x 1.82% 99.96%
liquid-render 211.0 0.36% 87.8 0.47% 81.6 0.64% 2.40x 0.59% 2.58x 0.73% 99.90%
lobsters 1346.0 1.19% 904.1 1.36% 880.1 1.47% 1.49x 1.80% 1.53x 1.89% 99.18%
mail 180.2 0.40% 133.5 0.33% 125.1 0.38% 1.35x 0.52% 1.44x 0.55% 99.88%
psych-load 2808.5 0.06% 2036.0 0.06% 1640.4 0.06% 1.38x 0.09% 1.71x 0.09% 99.99%
railsbench 3446.6 0.14% 2068.6 0.26% 1938.5 0.22% 1.67x 0.29% 1.78x 0.26% 99.81%
rubocop 209.2 0.98% 128.2 2.35% 111.2 2.62% 1.63x 2.54% 1.88x 2.80% 99.86%
ruby-lsp 159.7 1.19% 122.6 1.47% 119.3 3.16% 1.30x 1.89% 1.34x 3.38% 97.57%
sequel 93.1 0.44% 75.0 0.49% 69.7 0.45% 1.24x 0.66% 1.34x 0.63% 98.83%
binarytrees 501.9 1.11% 289.0 0.15% 231.7 2.34% 1.74x 1.12% 2.17x 2.59% 99.99%
blurhash 453.3 0.78% 222.1 0.25% 198.0 0.27% 2.04x 0.82% 2.29x 0.83% 99.99%
erubi 321.8 0.13% 282.7 0.19% 259.0 0.16% 1.14x 0.23% 1.24x 0.21% 99.98%
etanni 880.3 0.35% 421.4 0.14% 818.4 0.09% 2.09x 0.37% 1.08x 0.36% 99.95%
fannkuchredux 2348.5 0.21% 943.9 0.05% 791.2 0.06% 2.49x 0.21% 2.97x 0.22% 74.28%
fluentd 2605.8 0.69% 2717.0 0.92% 2423.2 0.95% 0.96x 1.14% 1.08x 1.17% 99.98%
graphql 4475.5 0.08% 3975.3 0.06% 3658.4 0.06% 1.13x 0.10% 1.22x 0.10% 99.44%
graphql-native 672.4 0.12% 665.9 0.10% 597.8 0.11% 1.01x 0.15% 1.12x 0.16% 99.95%
lee 1463.2 1.10% 1215.8 0.10% 1013.1 1.56% 1.20x 1.10% 1.44x 1.90% 99.96%
matmul 2094.6 0.08% 1246.2 0.11% 1157.0 0.09% 1.68x 0.13% 1.81x 0.12% 99.64%
nbody 143.1 0.03% 64.7 0.06% 62.8 0.39% 2.21x 0.07% 2.28x 0.40% 99.79%
nqueens 255.6 0.58% 249.8 0.33% 63.6 0.14% 1.02x 0.67% 4.02x 0.60% 94.61%
optcarrot 7260.2 0.39% 2338.0 0.43% 2051.8 0.78% 3.11x 0.58% 3.54x 0.87% 99.49%
protoboeuf 157.7 0.25% 54.4 0.38% 40.7 0.51% 2.90x 0.45% 3.87x 0.57% 99.99%
rack 65.0 0.75% 38.9 0.95% 36.0 1.04% 1.67x 1.21% 1.80x 1.28% 99.87%
ruby-json 4122.0 0.04% 3785.5 0.09% 3522.7 0.04% 1.09x 0.10% 1.17x 0.06% 99.98%
rubykon 14309.9 0.40% 7469.0 1.49% 6703.0 0.87% 1.92x 1.54% 2.13x 0.96% 99.95%
sudoku 2128.0 0.04% 839.1 0.03% 733.7 0.05% 2.54x 0.05% 2.90x 0.06% 99.71%
tinygql 946.3 0.08% 533.3 0.08% 516.8 0.10% 1.77x 0.11% 1.83x 0.13% 99.98%
30k_ifelse 2531.6 0.08% 360.0 0.08% 359.9 0.08% 7.03x 0.12% 7.03x 0.12% 99.94%
30k_methods 6799.7 0.03% 833.0 0.04% 840.2 0.04% 8.16x 0.05% 8.09x 0.05% 99.98%
cfunc_itself 111.3 0.10% 26.8 6.90% 24.4 8.18% 4.15x 6.91% 4.56x 8.18% 94.96%
fib 302.4 0.07% 48.0 0.20% 47.8 0.04% 6.30x 0.21% 6.32x 0.08% 99.99%
getivar 112.8 0.31% 22.6 48.50% 21.1 53.33% 5.00x 48.50% 5.36x 53.33% 76.32%
keyword_args 313.4 0.72% 40.9 5.14% 31.3 7.32% 7.65x 5.19% 10.02x 7.35% 96.19%
respond_to 302.2 0.68% 17.2 7.76% 13.8 10.71% 17.57x 7.79% 21.87x 10.73% 95.32%
ruby-xor 752.5 0.06% 288.4 0.22% 195.7 0.10% 2.61x 0.23% 3.84x 0.12% 99.99%
setivar 78.4 0.32% 12.5 42.48% 8.2 62.61% 6.29x 42.48% 9.52x 62.61% 85.09%
setivar_object 164.0 6.57% 64.7 33.38% 56.1 51.59% 2.53x 34.02% 2.92x 52.01% 82.09%
setivar_young 161.8 1.12% 57.7 29.99% 56.1 50.32% 2.80x 30.01% 2.88x 50.34% 82.09%
str_concat 87.1 0.94% 46.2 1.33% 48.1 1.14% 1.89x 1.63% 1.81x 1.48% 99.89%
throw 31.4 0.22% 25.5 0.23% 25.9 0.33% 1.23x 0.32% 1.21x 0.39% 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.
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-05-11T11:47:15Z :detached: 7e604a0263) +YJIT [x86_64-linux]
Tested Ruby version for stable CRuby and YJIT: ruby 3.3.1 (2024-04-23 revision c56cd86388) +YJIT [x86_64-linux]

Benchmark Memory Usage Details

bench CRuby 3.4.0dev mem (MiB) YJIT 3.3.1 mem (MiB) YJIT 3.4.0dev mem (MiB) Inline Code Outlined Code YJIT Mem overhead
activerecord 68 74 75 2 2 10.8%
chunky-png 55 47 56 1 1 1.9%
erubi-rails 108 110 113 2 2 4.3%
hexapdf 132 165 257 2 2 94.1%
liquid-c 37 40 41 1 1 10.1%
liquid-compile 35 35 38 1 1 8.9%
liquid-render 37 41 42 1 1 15.1%
lobsters 265 315 330 8 7 24.6%
mail 68 54 71 1 1 5.5%
psych-load 34 35 36 1 1 4.7%
railsbench 107 116 117 3 3 8.5%
rubocop 92 118 124 6 5 34.8%
ruby-lsp 78 88 88 1 1 13.0%
sequel 39 40 42 1 1 7.3%
binarytrees 26 24 27 1 1 4.1%
blurhash 22 22 22 1 1 1.0%
erubi 31 31 32 1 1 3.8%
etanni 24 23 24 1 1 0.7%
fannkuchredux 21 20 21 1 1 0.9%
fluentd 609 603 660 1 1 8.4%
graphql 40 43 43 1 1 7.4%
graphql-native 39 39 41 1 1 6.5%
lee 34 32 36 1 1 4.2%
matmul 33 32 33 1 1 0.5%
nbody 21 20 21 1 1 1.1%
nqueens 21 20 22 1 1 4.7%
optcarrot 59 60 65 1 1 9.0%
protoboeuf 32 29 39 1 1 18.4%
rack 32 32 34 1 1 6.1%
ruby-json 21 21 22 1 1 0.8%
rubykon 48 48 46 1 1 -2.5%
sudoku 21 20 21 1 1 1.1%
tinygql 29 29 31 1 1 6.1%
30k_ifelse 146 90 154 5 5 5.2%
30k_methods 93 58 102 2 2 10.3%
cfunc_itself 21 20 21 1 1 1.6%
fib 21 20 21 1 1 1.3%
getivar 21 20 21 1 1 1.6%
keyword_args 21 20 21 1 1 1.6%
respond_to 21 20 21 1 1 1.7%
ruby-xor 22 21 22 1 1 0.7%
setivar 21 20 21 1 1 1.7%
setivar_object 21 20 21 1 1 1.0%
setivar_young 21 20 21 1 1 1.0%
str_concat 48 46 47 1 1 -0.3%
throw 21 20 21 1 1 0.7%

Memory is shown in mebibytes (1024 * 1024 bytes.)

Older YJIT allocated an additional 256MiB for generated code. Current YJIT allocates executable memory on demand, so this overhead should no longer be present.

Number of Iterations and Warmups Tested

bench CRuby 3.4.0dev warmups CRuby 3.4.0dev iters YJIT 3.3.1 warmups YJIT 3.3.1 iters YJIT 3.4.0dev warmups YJIT 3.4.0dev iters
activerecord 10 49 10 98 10 114
chunky-png 10 17 10 34 10 38
erubi-rails 10 10 10 18 10 19
hexapdf 10 10 10 10 10 10
liquid-c 10 346 10 467 10 503
liquid-compile 10 338 10 458 10 492
liquid-render 10 133 10 331 10 357
lobsters 10 13 10 22 10 23
mail 10 155 10 213 10 227
psych-load 10 10 10 10 10 10
railsbench 10 10 10 10 10 10
rubocop 10 131 10 212 10 244
ruby-lsp 10 178 10 235 10 241
sequel 10 313 10 391 10 421
binarytrees 10 50 10 94 10 120
blurhash 10 57 10 126 10 142
erubi 10 84 10 97 10 106
etanni 10 25 10 62 10 27
fannkuchredux 10 10 10 14 10 17
fluentd 10 10 10 10 10 10
graphql 10 10 10 10 10 10
graphql-native 10 35 10 36 10 41
lee 10 11 10 15 10 20
matmul 10 10 10 15 10 16
nbody 10 200 10 454 10 468
nqueens 10 108 10 111 10 454
optcarrot 10 10 10 10 10 10
protoboeuf 10 181 10 541 10 726
rack 10 452 10 761 10 823
ruby-json 10 10 10 10 10 10
rubykon 10 10 10 10 10 10
sudoku 10 10 10 26 10 31
tinygql 10 22 10 47 10 48
30k_ifelse 10 10 10 70 10 70
30k_methods 10 10 10 26 10 26
cfunc_itself 10 260 10 1104 10 1212
fib 10 90 10 616 10 618
getivar 10 256 10 1279 10 1370
keyword_args 10 86 10 720 10 945
respond_to 10 90 10 1728 10 2151
ruby-xor 10 30 10 94 10 144
setivar 10 373 10 2350 10 3549
setivar_object 10 174 10 446 10 507
setivar_young 10 176 10 501 10 506
str_concat 10 335 10 639 10 614
throw 10 945 10 1165 10 1149

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) 1426391 1245921 214 2184 0 0% 0 0 66.220753
chunky-png (click) 327754 258461 82 1048 1 0% 0 0 31.062697
erubi-rails (click) 1694938 1450493 272 2943 6 0% 0 0 83.6633
hexapdf (click) 1295298 1124594 504 11518 41 0% 0 0 335.682529
liquid-c (click) 525708 464856 119 1757 5 0% 0 0 48.838991
liquid-compile (click) 451043 389278 151 2084 2 0% 0 0 64.40294
liquid-render (click) 623961 512342 136 2292 8 0% 0 0 63.412355
lobsters (click) 7558607 6350555 3110 48973 89 0% 0 0 1637.429212
mail (click) 720578 651876 346 4865 14 0% 0 0 144.546905
psych-load (click) 303929 236036 61 617 3 0% 0 0 19.622498
railsbench (click) 2954122 2471658 1633 15943 57 0% 0 0 461.514135
rubocop (click) 5329499 4616761 2901 48249 112 0% 4 0 1442.374051
ruby-lsp (click) 633673 586435 159 2808 28 0% 0 0 78.279787
sequel (click) 488822 417092 16 118 0 0% 0 0 4.401841
binarytrees (click) 8756 7777 10 70 0 0% 0 0 2.82362
blurhash (click) 50429 43273 31 455 0 0% 0 0 15.390891
erubi (click) 271987 233309 10 112 0 0% 0 0 3.838682
etanni (click) 29692 28216 11 91 0 0% 0 0 2.984516
fannkuchredux (click) 21198 26809 5 228 0 0% 0 0 7.225338
fluentd (click) 385166 328449 4 28 0 0% 0 0 1.154943
graphql (click) 427888 327863 66 644 0 0% 0 0 19.687854
graphql-native (click) 410040 368575 42 278 0 0% 0 0 9.311429
lee (click) 300573 267787 34 528 0 0% 0 0 16.896992
matmul (click) 8300 983 8 85 0 0% 0 0 2.943371
nbody (click) 14798 17933 11 185 0 0% 0 0 5.220427
nqueens (click) 22703 29059 10 260 0 0% 0 0 7.868552
optcarrot (click) 307949 264223 188 4285 34 0% 0 0 101.728009
protoboeuf (click) 146719 143337 17 1366 0 0% 0 0 41.734749
rack (click) 281198 218988 37 455 0 0% 0 0 12.467353
ruby-json (click) 30222 27890 8 167 0 0% 0 0 4.845572
rubykon (click) 127405 128474 137 1461 3 0% 0 0 41.74005
sudoku (click) 42479 58142 8 475 0 0% 0 0 14.892341
tinygql (click) 315372 264441 58 741 5 0% 0 0 21.47545
30k_ifelse (click) 5134674 4729436 9259 50778 0 0% 0 0 1496.592207
30k_methods (click) 2016920 1591842 5778 19339 0 0% 0 0 511.868519
cfunc_itself (click) 7534 6180 9 70 0 0% 0 0 2.255676
fib (click) 4970 5003 8 49 0 0% 0 0 1.76067
getivar (click) 5963 6375 8 74 0 0% 0 0 2.12593
keyword_args (click) 8409 6912 10 72 0 0% 0 0 2.508122
respond_to (click) 8277 8274 9 85 0 0% 0 0 2.657647
ruby-xor (click) 5593 5796 5 62 0 0% 0 0 1.757036
setivar (click) 5102 5375 8 54 0 0% 0 0 1.79053
setivar_object (click) 5470 5395 8 54 0 0% 0 0 1.874907
setivar_young (click) 6182 6093 9 62 0 0% 0 0 2.088647
str_concat (click) 7774 7946 11 85 0 0% 0 0 2.887582
throw (click) 7895 6377 10 69 0 0% 0 0 2.591041

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.