Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions benchmarks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,11 @@ throw:
#
# Ractor scaling benchmarks
#
symbol-name-ractor:
desc: repeatedly calls Symbol#name on a static symbol under the ractor harness to stress ID-to-string lookup.
ractor: true
ractor_only: true
default_harness: harness-ractor
gvl_release_acquire:
desc: microbenchmark designed to test how fast the gvl can be acquired and released between ractors.
ractor: true
Expand Down
18 changes: 18 additions & 0 deletions benchmarks/symbol-name-ractor/benchmark.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
require_relative "../../harness/loader"

SYMBOL = :ruby_bench_id2str_pressure_static_symbol
EXPECTED_NAME = SYMBOL.name
ITERATIONS = Integer(ENV.fetch("SYMBOL_NAME_RACTOR_ITERS", 10_000_000))

run_benchmark(5) do |num_ractors = 0|
iterations = num_ractors.zero? ? ITERATIONS : [ITERATIONS / num_ractors, 1].max

name = nil
i = 0
while i < iterations
name = SYMBOL.name
i += 1
end

raise "unexpected Symbol#name result" unless name.equal?(EXPECTED_NAME)
end
Loading