Skip to content

Commit ca6b1c6

Browse files
authored
Avoid pinning the CPU to the last core (#318)
1 parent 51396ba commit ca6b1c6

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

run_benchmarks.rb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,9 @@ def run_benchmarks(ruby:, ruby_description:, categories:, name_filters:, out_pat
253253
# Pin the process to one given core to improve caching and reduce variance on CRuby
254254
# Other Rubies need to use multiple cores, e.g., for JIT threads
255255
if ruby_description.start_with?('ruby ') && !no_pinning
256-
cmd += ["taskset", "-c", "#{Etc.nprocessors - 1}"]
256+
# The last few cores of Intel CPU may be slow E-Cores, so avoid using the last one.
257+
cpu = [(Etc.nprocessors / 2) - 1, 0].max
258+
cmd += ["taskset", "-c", "#{cpu}"]
257259
end
258260
end
259261

0 commit comments

Comments
 (0)