From e4c0c3ae1c8a819abd817d80edd18d53d888cb40 Mon Sep 17 00:00:00 2001 From: Takashi Kokubun Date: Fri, 3 Apr 2026 10:22:30 -0700 Subject: [PATCH 1/2] Suppress a warning from send_rubyfunc_block --- benchmarks/send_rubyfunc_block.rb | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/benchmarks/send_rubyfunc_block.rb b/benchmarks/send_rubyfunc_block.rb index 6cdeba9b..2fbb3f44 100644 --- a/benchmarks/send_rubyfunc_block.rb +++ b/benchmarks/send_rubyfunc_block.rb @@ -1,8 +1,9 @@ require_relative '../harness/loader' class C - def ruby_func + def ruby_func(call_block) # Don't even yield + yield if call_block end end @@ -11,14 +12,14 @@ def ruby_func run_benchmark(500) do 500_000.times do |i| # Manually unrolling to avoid loop overhead - INSTANCE.ruby_func {} - INSTANCE.ruby_func {} - INSTANCE.ruby_func {} - INSTANCE.ruby_func {} - INSTANCE.ruby_func {} - INSTANCE.ruby_func {} - INSTANCE.ruby_func {} - INSTANCE.ruby_func {} - INSTANCE.ruby_func {} + INSTANCE.ruby_func(false) {} + INSTANCE.ruby_func(false) {} + INSTANCE.ruby_func(false) {} + INSTANCE.ruby_func(false) {} + INSTANCE.ruby_func(false) {} + INSTANCE.ruby_func(false) {} + INSTANCE.ruby_func(false) {} + INSTANCE.ruby_func(false) {} + INSTANCE.ruby_func(false) {} end end From e8c4804907689a4a30fdbfbadbdd67ce13afe5e2 Mon Sep 17 00:00:00 2001 From: Takashi Kokubun Date: Fri, 3 Apr 2026 11:50:27 -0700 Subject: [PATCH 2/2] Constantize call_block Co-authored-by: Max Bernstein --- benchmarks/send_rubyfunc_block.rb | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/benchmarks/send_rubyfunc_block.rb b/benchmarks/send_rubyfunc_block.rb index 2fbb3f44..ae3f3734 100644 --- a/benchmarks/send_rubyfunc_block.rb +++ b/benchmarks/send_rubyfunc_block.rb @@ -1,9 +1,11 @@ require_relative '../harness/loader' class C - def ruby_func(call_block) - # Don't even yield - yield if call_block + CALL_BLOCK = false + + def ruby_func + # Don't even yield. But we leave yield to suppress a warning. + yield if CALL_BLOCK end end @@ -12,14 +14,14 @@ def ruby_func(call_block) run_benchmark(500) do 500_000.times do |i| # Manually unrolling to avoid loop overhead - INSTANCE.ruby_func(false) {} - INSTANCE.ruby_func(false) {} - INSTANCE.ruby_func(false) {} - INSTANCE.ruby_func(false) {} - INSTANCE.ruby_func(false) {} - INSTANCE.ruby_func(false) {} - INSTANCE.ruby_func(false) {} - INSTANCE.ruby_func(false) {} - INSTANCE.ruby_func(false) {} + INSTANCE.ruby_func {} + INSTANCE.ruby_func {} + INSTANCE.ruby_func {} + INSTANCE.ruby_func {} + INSTANCE.ruby_func {} + INSTANCE.ruby_func {} + INSTANCE.ruby_func {} + INSTANCE.ruby_func {} + INSTANCE.ruby_func {} end end