Skip to content

Commit 95e1a3c

Browse files
committed
Benchmark mutable strings
1 parent 737d021 commit 95e1a3c

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

run_benchmarks.rb

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ def sort_benchmarks(bench_names)
211211
end
212212

213213
# Run all the benchmarks and record execution times
214-
def run_benchmarks(ruby:, ruby_description:, categories:, name_filters:, out_path:, harness:, pre_init:, no_pinning:)
214+
def run_benchmarks(name:, ruby:, ruby_description:, categories:, name_filters:, out_path:, harness:, pre_init:, no_pinning:)
215215
bench_data = {}
216216

217217
# Get the list of benchmark files/directories matching name filters
@@ -276,6 +276,11 @@ def run_benchmarks(ruby:, ruby_description:, categories:, name_filters:, out_pat
276276
end
277277
end
278278

279+
if name == "mutable"
280+
cmd = ["env", "MUTABLE_STRINGS=true", *cmd]
281+
# env["MUTABLE_STRINGS"] = "true"
282+
end
283+
279284
# Do the benchmarking
280285
check_call(cmd.shelljoin, env: env)
281286

@@ -392,19 +397,17 @@ def run_benchmarks(ruby:, ruby_description:, categories:, name_filters:, out_pat
392397
end
393398
end.parse!
394399

400+
args.categories = ["headline"]
401+
395402
# Remaining arguments are treated as benchmark name filters
396403
if ARGV.length > 0
397404
args.name_filters += ARGV
398405
end
399406

400407
# If -e is not specified, benchmark the current Ruby. Compare it with YJIT if available.
401408
if args.executables.empty?
402-
if have_yjit?(RbConfig.ruby)
403-
args.executables["interp"] = [RbConfig.ruby]
404-
args.executables["yjit"] = [RbConfig.ruby, "--yjit", *args.yjit_opts.shellsplit]
405-
else
406-
args.executables["ruby"] = [RbConfig.ruby]
407-
end
409+
args.executables["mutable"] = [RbConfig.ruby, "--yjit", *args.yjit_opts.shellsplit]
410+
args.executables["frozen"] = [RbConfig.ruby, "--yjit", *args.yjit_opts.shellsplit]
408411
end
409412

410413
# Disable CPU frequency scaling
@@ -426,6 +429,7 @@ def run_benchmarks(ruby:, ruby_description:, categories:, name_filters:, out_pat
426429
bench_data = {}
427430
args.executables.each do |name, executable|
428431
bench_data[name] = run_benchmarks(
432+
name: name,
429433
ruby: executable,
430434
ruby_description: ruby_descriptions[name],
431435
categories: args.categories,

0 commit comments

Comments
 (0)