Use UInt64 to track iteration count during warm-up calculation in Benchmark::IPS#15780
Merged
straight-shoota merged 2 commits intocrystal-lang:masterfrom May 19, 2025
Merged
Conversation
If the warm-up duration is too long then the iteration count in `run_warmup` can easily exceed the 32 bit integer limit in a little under a minute resulting in an `OverflowError`. This commit just change the tracker variable to an unsigned 64 bit integer so that an overflow is pretty much impossible
Sija
reviewed
May 16, 2025
Co-authored-by: Sijawusz Pur Rahnama <sija@sija.pl>
straight-shoota
approved these changes
May 16, 2025
ysbaddaden
approved these changes
May 16, 2025
Int64 to track iteration count during warm-up calculation in Benchmark::IPSUInt64 to track iteration count during warm-up calculation in Benchmark::IPS
1 task
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.
If the warm-up duration is long enough then the iteration count in
run_warmupcan easily exceed the 32 bit integer limit in a little under a minute resulting in anOverflowError.This PR just change the tracker variable to an unsigned 64 bit integer so that an overflow is pretty much impossible
You can reproduce the overflow with:
I don't think there's any practical reasons someone would set the
warmupduration to be that high but I don't thinkBenchmark.ipsshould fail this easily either.