Skip to content

Commit e8c4804

Browse files
k0kubuntekknolagi
andcommitted
Constantize call_block
Co-authored-by: Max Bernstein <max@bernsteinbear.com>
1 parent e4c0c3a commit e8c4804

1 file changed

Lines changed: 14 additions & 12 deletions

File tree

‎benchmarks/send_rubyfunc_block.rb‎

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
require_relative '../harness/loader'
22

33
class C
4-
def ruby_func(call_block)
5-
# Don't even yield
6-
yield if call_block
4+
CALL_BLOCK = false
5+
6+
def ruby_func
7+
# Don't even yield. But we leave yield to suppress a warning.
8+
yield if CALL_BLOCK
79
end
810
end
911

@@ -12,14 +14,14 @@ def ruby_func(call_block)
1214
run_benchmark(500) do
1315
500_000.times do |i|
1416
# Manually unrolling to avoid loop overhead
15-
INSTANCE.ruby_func(false) {}
16-
INSTANCE.ruby_func(false) {}
17-
INSTANCE.ruby_func(false) {}
18-
INSTANCE.ruby_func(false) {}
19-
INSTANCE.ruby_func(false) {}
20-
INSTANCE.ruby_func(false) {}
21-
INSTANCE.ruby_func(false) {}
22-
INSTANCE.ruby_func(false) {}
23-
INSTANCE.ruby_func(false) {}
17+
INSTANCE.ruby_func {}
18+
INSTANCE.ruby_func {}
19+
INSTANCE.ruby_func {}
20+
INSTANCE.ruby_func {}
21+
INSTANCE.ruby_func {}
22+
INSTANCE.ruby_func {}
23+
INSTANCE.ruby_func {}
24+
INSTANCE.ruby_func {}
25+
INSTANCE.ruby_func {}
2426
end
2527
end

0 commit comments

Comments
 (0)