Skip to content

Add --zjit-mem flag to show ZJIT memory stats in summary table#498

Open
k0kubun wants to merge 1 commit intoruby:mainfrom
k0kubun:zjit-code-size-diff
Open

Add --zjit-mem flag to show ZJIT memory stats in summary table#498
k0kubun wants to merge 1 commit intoruby:mainfrom
k0kubun:zjit-code-size-diff

Conversation

@k0kubun
Copy link
Member

@k0kubun k0kubun commented Mar 25, 2026

Show code_region_bytes and zjit_alloc_bytes per executable in the summary table when --zjit-mem is passed.

Example:

$ ./run_benchmarks.rb lobsters --chruby 'before --zjit;after --zjit' --zjit-mem --no-sudo --warmup=1 --bench=1
Running benchmark "lobsters" (1/1)
+ setarch x86_64 -R taskset -c 10 /opt/rubies/before/bin/ruby --zjit -I harness /home/k0kubun/src/github.com/ruby/ruby-bench/benchmarks/lobsters/benchmark.rb
ruby 4.1.0dev (2026-03-24T17:47:36Z master-iseq 756c801f50) +ZJIT +PRISM [x86_64-linux]
Command: bundle check 2> /dev/null || bundle install
The Gemfile's dependencies are satisfied
itr:   time
 #1: 2015ms
 #2:  913ms
ZJIT stats:
code_region_bytes:     10,579,968
zjit_alloc_bytes:      13,726,764
compile_time            1891.17ms
profile_time              17.73ms
gc_time                   15.27ms
invalidation_time         11.85ms
RSS: 333.0MiB
MAXRSS: 334.2MiB
Running benchmark "lobsters" (1/1)
+ setarch x86_64 -R taskset -c 10 /opt/rubies/after/bin/ruby --zjit -I harness /home/k0kubun/src/github.com/ruby/ruby-bench/benchmarks/lobsters/benchmark.rb
ruby 4.1.0dev (2026-03-24T21:47:14Z master 30dcc2a082) +ZJIT +PRISM [x86_64-linux]
Command: bundle check 2> /dev/null || bundle install
The Gemfile's dependencies are satisfied
itr:   time
 #1: 2014ms
 #2:  872ms
ZJIT stats:
code_region_bytes:      9,736,192
zjit_alloc_bytes:      13,746,992
compile_time            1891.66ms
profile_time              17.62ms
gc_time                   15.87ms
invalidation_time         12.28ms
RSS: 331.3MiB
MAXRSS: 332.6MiB
Total time spent benchmarking: 14s

before: ruby 4.1.0dev (2026-03-24T17:47:36Z master-iseq 756c801f50) +ZJIT +PRISM [x86_64-linux]
after: ruby 4.1.0dev (2026-03-24T21:47:14Z master 30dcc2a082) +ZJIT +PRISM [x86_64-linux]

--------  ------------  ----------  ----------  ------------  ---------  ----------  -------------  ------------
bench      before (ms)    code (B)   alloc (B)    after (ms)   code (B)   alloc (B)  after 1st itr  before/after
lobsters  913.8 ± 0.0%  10,579,968  13,726,764  872.1 ± 0.0%  9,736,192  13,746,992          1.000         1.048
--------  ------------  ----------  ----------  ------------  ---------  ----------  -------------  ------------

Show code_region_bytes and zjit_alloc_bytes (in KiB) per executable,
with before/after ratio columns, when --zjit-mem is passed.
@k0kubun k0kubun requested a review from a team March 25, 2026 21:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant