Skip to content

ZJIT: Some benchmarks are significantly slower with ZJIT than the interpreter on yjit-bench #692

@k0kubun

Description

@k0kubun

I thought it's a warmup issue at first, which is kinda true for rubocop. But all of the following benchmarks were significantly slow on later iterations as well.

Interpreter

$ ./run_benchmarks.rb activerecord hexapdf railsbench rubocop --chruby 'interp::ruby-release' --turbo --warmup=1 --bench=2
Running benchmark "activerecord" (1/4)
itr:   time
 #1:  195ms
 #2:  191ms
 #3:  191ms

Running benchmark "hexapdf" (2/4)
itr:   time
 #1: 1636ms
 #2: 1523ms
 #3: 1536ms

Running benchmark "railsbench" (3/4)
itr:   time
 #1: 1980ms
 #2: 1893ms
 #3: 1950ms

Running benchmark "rubocop" (4/4)
itr:   time
 #1:  393ms
 #2:  120ms
 #3:  117ms

interp: ruby 3.5.0dev (2025-08-08T20:37:31Z master 07878ebe78) +PRISM [x86_64-linux]

------------  -----------  ----------
bench         interp (ms)  stddev (%)
activerecord  191.3        0.0
hexapdf       1530.1       0.4
railsbench    1921.7       1.5
rubocop       118.8        1.1
------------  -----------  ----------

ZJIT

$ ./run_benchmarks.rb activerecord hexapdf railsbench rubocop --chruby 'zjit::ruby-release --zjit' --turbo --warmup=1 --bench=2
Running benchmark "activerecord" (1/4)
itr:   time
 #1: 3120ms
 #2: 3114ms
 #3: 3144ms

Running benchmark "hexapdf" (2/4)
itr:   time
 #1: 93424ms
 #2: 94814ms
 #3: 95085ms

Running benchmark "railsbench" (3/4)
itr:   time
 #1: 25915ms
 #2: 25842ms
 #3: 26018ms

Running benchmark "rubocop" (4/4)
 #1: 8304ms
 #2: 2072ms
 #3: 2090ms

zjit: ruby 3.5.0dev (2025-08-08T20:37:31Z master 07878ebe78) +ZJIT +PRISM [x86_64-linux]

------------  ---------  ----------
bench         zjit (ms)  stddev (%)
activerecord  3129.2     0.5
hexapdf       94950.3    0.1
railsbench    25930.6    0.3
rubocop       2081.8     0.4
------------  ---------  ----------

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions