Add send-with-block benchmark - #526
Merged
Merged
Conversation
tekknolagi
marked this pull request as ready for review
September 9, 2026 12:51
tekknolagi
force-pushed
the
mb-add-block-benchmark
branch
from
September 15, 2026 20:57
63d3e63 to
4fc54ac
Compare
k0kubun
reviewed
Sep 17, 2026
Comment on lines
+68
to
+70
| run_benchmark(1000) do | ||
| i = 0 | ||
| while i < 10 |
Member
There was a problem hiding this comment.
How long does each iteration take? My understanding is that the shorter each iteration is, the noisier the benchmark is, because it needs to go through non-benchmark code a lot (after each iteration). So if it takes 1000 iterations to run for the default benchmark duration, I would make < 10 larger.
However, if the intention is to encourage a JIT to inline everything from the block given to run_benchmark and avoid staying in iterations that do not compile the block too long, I'm fine with configuring it this way.
Contributor
Author
There was a problem hiding this comment.
plum% ruby benchmarks/block_methods.rb
ruby 4.1.0dev (2026-09-17T15:01:37Z mb-condbranch-chec.. c4ea80f56a) +PRISM [arm64-darwin25]
itr: time
#1: 359ms
#2: 361ms
#3: 369ms
#4: 361ms
#5: 365ms
#6: 360ms
#7: 363ms
^Cbenchmarks/block_methods.rb:44:in 'block in Object#kernel_tap': Interrupt
from benchmarks/block_methods.rb:42:in 'Kernel#tap'
from benchmarks/block_methods.rb:42:in 'Object#kernel_tap'
from benchmarks/block_methods.rb:75:in 'block in <main>'
from /Users/emacs/Documents/code/yjit-bench/harness/harness.rb:30:in 'Object#realtime'
from /Users/emacs/Documents/code/yjit-bench/harness/harness.rb:56:in 'Object#run_benchmark'
from benchmarks/block_methods.rb:68:in '<main>'
plum% ruby --zjit benchmarks/block_methods.rb
ruby 4.1.0dev (2026-09-17T15:01:37Z mb-condbranch-chec.. c4ea80f56a) +ZJIT stats +PRISM [arm64-darwin25]
itr: time
#1: 267ms
#2: 261ms
#3: 222ms
#4: 84ms
#5: 85ms
#6: 86ms
#7: 86ms
#8: 84ms
#9: 85ms
#10: 84ms
#11: 83ms
#12: 84ms
#13: 85ms
#14: 84ms
#15: 83ms
#16: 95ms
#17: 91ms
^Cbenchmarks/block_methods.rb:15:in 'block in Object#array_map': Interrupt
from benchmarks/block_methods.rb:13:in 'Array#map'
from benchmarks/block_methods.rb:13:in 'Object#array_map'
from benchmarks/block_methods.rb:72:in 'block in <main>'
from /Users/emacs/Documents/code/yjit-bench/harness/harness.rb:30:in 'Object#realtime'
from /Users/emacs/Documents/code/yjit-bench/harness/harness.rb:56:in 'Object#run_benchmark'
from benchmarks/block_methods.rb:68:in '<main>'
plum%
k0kubun
approved these changes
Sep 17, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Benchmarks send-with-block, especially polymorphic send-with-block. Gives us information on how much inlining-driven monomorphization is helping.