Skip to content

Commit b572f10

Browse files
committed
Simplify base_cmd
1 parent f38b0f6 commit b572f10

File tree

1 file changed

+11
-13
lines changed

1 file changed

+11
-13
lines changed

lib/benchmark_suite.rb

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -176,22 +176,20 @@ def linux?
176176

177177
# Set up the base command with CPU pinning if needed
178178
def base_cmd
179-
@base_cmd ||= begin
180-
cmd = []
181-
182-
if linux?
183-
cmd += setarch_prefix
184-
185-
# Pin the process to one given core to improve caching and reduce variance on CRuby
186-
# Other Rubies need to use multiple cores, e.g., for JIT threads
187-
if ruby_description.start_with?('ruby ') && !no_pinning
188-
# The last few cores of Intel CPU may be slow E-Cores, so avoid using the last one.
189-
cpu = [(Etc.nprocessors / 2) - 1, 0].max
190-
cmd += ["taskset", "-c", "#{cpu}"]
191-
end
179+
@base_cmd ||= if linux?
180+
cmd = setarch_prefix
181+
182+
# Pin the process to one given core to improve caching and reduce variance on CRuby
183+
# Other Rubies need to use multiple cores, e.g., for JIT threads
184+
if ruby_description.start_with?('ruby ') && !no_pinning
185+
# The last few cores of Intel CPU may be slow E-Cores, so avoid using the last one.
186+
cpu = [(Etc.nprocessors / 2) - 1, 0].max
187+
cmd.concat(["taskset", "-c", "#{cpu}"])
192188
end
193189

194190
cmd
191+
else
192+
[]
195193
end
196194
end
197195

0 commit comments

Comments
 (0)