Repository navigation
Pin benchmarks to a CPU on Windows - #549
Merged
Merged
Conversation
$VERBOSE stayed nil after a LoadError from require 'fiddle', which silenced the warning of the caller that rescued it and every later one in the benchmark. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Without taskset, the runner passes the CPU through RUBY_BENCH_PIN_CPU and the harness pins itself with SetProcessAffinityMask. On a Ryzen AI 9 HX 370, an unpinned run moves between Zen5 and Zen5c cores, which differ in speed by about 30%. The CPU is chosen as on Linux and is a Zen5 one there. A failure to pin, for example without fiddle, leaves the benchmark running unpinned with a warning. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A pinned benchmark still shares its CPU with whatever else Windows runs there, and in one pinned run fib and nbody on the interpreter varied by over 25% between iterations. The harness now also takes HIGH_PRIORITY_CLASS, which preempts other processes on that CPU only, and turns off the EXECUTION_SPEED power throttling that Windows 11 may apply to a process without a visible window. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This was referenced Oct 13, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
On Windows, benchmarks are never pinned because
tasksetis Linux only. On my Ryzen AI 9 HX 370, an unpinned benchmark moves between Zen 5 and Zen 5c cores, which differ in speed by about 30%. The binarytrees benchmark on YJIT took 101-105 ms with 4-6% variation between iterations.With this change, the runner passes the CPU it would give
tasksetthroughRUBY_BENCH_PIN_CPU, and the harness pins itself withSetProcessAffinityMask. The same benchmark then took 90-95 ms with 2-5% variation. A pinned benchmark also takesHIGH_PRIORITY_CLASS, which only affects its own CPU, and opts out of power throttling. If pinning fails, the benchmark runs unpinned with a warning.The first commit fixes
load_fiddle, which left$VERBOSEnil after fiddle failed to load and silenced that warning.Generated with Claude Code