File tree Expand file tree Collapse file tree
benchmarks/symbol-name-ractor Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -255,6 +255,11 @@ throw:
255255#
256256# Ractor scaling benchmarks
257257#
258+ symbol-name-ractor :
259+ desc : repeatedly calls Symbol#name on a static symbol under the ractor harness to stress ID-to-string lookup.
260+ ractor : true
261+ ractor_only : true
262+ default_harness : harness-ractor
258263gvl_release_acquire :
259264 desc : microbenchmark designed to test how fast the gvl can be acquired and released between ractors.
260265 ractor : true
Original file line number Diff line number Diff line change 1+ require_relative "../../harness/loader"
2+
3+ SYMBOL = :ruby_bench_id2str_pressure_static_symbol
4+ EXPECTED_NAME = SYMBOL . name
5+ ITERATIONS = Integer ( ENV . fetch ( "SYMBOL_NAME_RACTOR_ITERS" , 10_000_000 ) )
6+
7+ run_benchmark ( 5 ) do |num_ractors = 0 |
8+ iterations = num_ractors . zero? ? ITERATIONS : [ ITERATIONS / num_ractors , 1 ] . max
9+
10+ name = nil
11+ i = 0
12+ while i < iterations
13+ name = SYMBOL . name
14+ i += 1
15+ end
16+
17+ raise "unexpected Symbol#name result" unless name . equal? ( EXPECTED_NAME )
18+ end
You can’t perform that action at this time.
0 commit comments