Skip to content

Commit 50a36ba

Browse files
authored
Add --no_yjit mode for burn-in test script (#348)
1 parent 257181e commit 50a36ba

File tree

1 file changed

+25
-16
lines changed

1 file changed

+25
-16
lines changed

burn_in.rb

Lines changed: 25 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
num_procs: Etc.nprocessors,
2121
num_long_runs: 4,
2222
categories: ['headline', 'other'],
23+
no_yjit: false,
2324
})
2425

2526
# Parse the command-line options
@@ -43,6 +44,10 @@
4344
opts.on("--category=headline,other,micro", "when given, only benchmarks with specified categories will run") do |v|
4445
args.categories = v.split(",")
4546
end
47+
48+
opts.on("--no_yjit", "when given, test with the CRuby interpreter, without enabling YJIT") do
49+
args.no_yjit = true
50+
end
4651
end.parse!
4752

4853
def free_file_path(parent_dir, name_prefix)
@@ -54,7 +59,7 @@ def free_file_path(parent_dir, name_prefix)
5459
end
5560
end
5661

57-
def run_benchmark(bench_name, logs_path, run_time, ruby_version)
62+
def run_benchmark(bench_name, no_yjit, logs_path, run_time, ruby_version)
5863
# Determine the path to the benchmark script
5964
script_path = File.join('benchmarks', bench_name, 'benchmark.rb')
6065
if not File.exist?(script_path)
@@ -75,18 +80,22 @@ def run_benchmark(bench_name, logs_path, run_time, ruby_version)
7580
env.merge!(test_env_vars)
7681

7782
# Assemble random command-line options to test
78-
test_options = [
79-
"--yjit-call-threshold=#{[1, 2, 10, 30].sample()}",
80-
"--yjit-cold-threshold=#{[1, 2, 5, 10, 500, 50_000].sample()}",
81-
[
82-
"--yjit-mem-size=#{[1, 2, 3, 4, 5, 10, 64, 128].sample()}",
83-
"--yjit-exec-mem-size=#{[1, 2, 3, 4, 5, 10, 64, 128].sample()}",
84-
].sample(),
85-
['--yjit-code-gc', nil].sample(),
86-
['--yjit-perf', nil].sample(),
87-
['--yjit-stats', nil].sample(),
88-
['--yjit-log=/dev/null', nil].sample(),
89-
].compact
83+
if no_yjit
84+
test_options = []
85+
else
86+
test_options = [
87+
"--yjit-call-threshold=#{[1, 2, 10, 30].sample()}",
88+
"--yjit-cold-threshold=#{[1, 2, 5, 10, 500, 50_000].sample()}",
89+
[
90+
"--yjit-mem-size=#{[1, 2, 3, 4, 5, 10, 64, 128].sample()}",
91+
"--yjit-exec-mem-size=#{[1, 2, 3, 4, 5, 10, 64, 128].sample()}",
92+
].sample(),
93+
['--yjit-code-gc', nil].sample(),
94+
['--yjit-perf', nil].sample(),
95+
['--yjit-stats', nil].sample(),
96+
['--yjit-log=/dev/null', nil].sample(),
97+
].compact
98+
end
9099

91100
# Assemble the command string
92101
cmd = [
@@ -137,12 +146,12 @@ def run_benchmark(bench_name, logs_path, run_time, ruby_version)
137146
return false
138147
end
139148

140-
def test_loop(bench_names, logs_path, run_time, ruby_version)
149+
def test_loop(bench_names, no_yjit, logs_path, run_time, ruby_version)
141150
error_found = false
142151

143152
while true
144153
bench_name = bench_names.sample()
145-
error = run_benchmark(bench_name, logs_path, run_time, ruby_version)
154+
error = run_benchmark(bench_name, no_yjit, logs_path, run_time, ruby_version)
146155
error_found ||= error
147156

148157
if error_found
@@ -194,7 +203,7 @@ def test_loop(bench_names, logs_path, run_time, ruby_version)
194203
args.num_procs.times do |i|
195204
pid = Process.fork do
196205
run_time = (i < args.num_long_runs)? (3600 * 2):10
197-
test_loop(bench_names, args.logs_path, run_time, ruby_version)
206+
test_loop(bench_names, args.no_yjit, args.logs_path, run_time, ruby_version)
198207
end
199208
end
200209

0 commit comments

Comments
 (0)