Repository navigation
Print GC harness averages without truncating them - #570
Open
thomasklemm wants to merge 1 commit into
Open
thomasklemm wants to merge 1 commit into
thomasklemm wants to merge 1 commit into
Conversation
GC.stat reports marking_time and sweeping_time in whole milliseconds, so the per-iteration deltas are Integers and the printed averages used Integer division. The JSON results are not affected.
thomasklemm
marked this pull request as ready for review
November 5, 2026 20:21
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.
The "Average marking time" and "Average sweeping time" lines that
--harness=gcprints are rounded down to whole milliseconds.GC.stat(:marking_time)andGC.stat(:sweeping_time)count whole milliseconds, so each iteration's value is an Integer, andharness/gc.rbdivided their sum with Integer division. For example, three iterations that mark 1, 0 and 0 ms print0.0msinstead of0.3ms. The error of up to 1 ms matters when marking takes a few milliseconds per iteration, as on railsbench with ZJIT (eight minor GCs of about 0.35 ms each). This usesfdiv. The results JSON and the summary tables don't go through these two lines, so nothing else changes.The new test runs the harness with stubbed GC samples and fails on main. I found this while measuring GC time for ruby/ruby#19685, alongside XrXr's #562 (timings without GC time) and eightbitraptor's #541 (GC per ruby table).