Skip to content

Commit 01698a8

Browse files
committed
Build harness arguments once during initialization
1 parent 2de2fee commit 01698a8

File tree

1 file changed

+14
-9
lines changed

1 file changed

+14
-9
lines changed

lib/benchmark_suite.rb

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ def initialize(categories:, name_filters:, excludes: [], out_path:, harness:, pr
3333
@ractor_only = (categories == RACTOR_ONLY_CATEGORY)
3434

3535
setup_benchmark_directories
36+
@harness_args = build_harness_args
3637
end
3738

3839
# Run all the benchmarks and record execution times
@@ -63,6 +64,8 @@ def run(ruby:, ruby_description:)
6364

6465
private
6566

67+
attr_reader :harness_args
68+
6669
def setup_benchmark_directories
6770
if @ractor_only
6871
@bench_dir = RACTOR_BENCHMARKS_DIR
@@ -151,15 +154,6 @@ def run_single_benchmark(script_path, result_json_path, ruby, cmd_prefix, env)
151154
ENV["RESULT_JSON_PATH"] = result_json_path
152155

153156
# Set up the benchmarking command
154-
# If harness is 'default', use default (no -r needed)
155-
# Otherwise use -r to load the specific harness file with full path
156-
harness_args = if harness == "default"
157-
[]
158-
else
159-
harness_path = File.join(HARNESS_DIR, harness)
160-
["-r", harness_path]
161-
end
162-
163157
cmd = cmd_prefix + [
164158
*ruby,
165159
*harness_args,
@@ -236,6 +230,17 @@ def setarch_prefix
236230
prefix
237231
end
238232

233+
# If harness is 'default', use default (no -r needed)
234+
# Otherwise use -r to load the specific harness file with full path
235+
def build_harness_args
236+
if harness == "default"
237+
[]
238+
else
239+
harness_path = File.join(HARNESS_DIR, harness)
240+
["-r", harness_path]
241+
end
242+
end
243+
239244
# Resolve the pre_init file path into a form that can be required
240245
def expand_pre_init(path)
241246
path = Pathname.new(path)

0 commit comments

Comments
 (0)