-
Notifications
You must be signed in to change notification settings - Fork 13.4k
test: Increase resolution of MB/s stat for bench runs close to 1 second #30959
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Conversation
r? @aturon (rust_highfive has picked a reviewer for you, use r? to override) |
https://play.rust-lang.org/?gist=10fd60f2cd7e5b2e48ac&version=stable numbers taken from the UTF-8 fast path PR, where the benches with duration around 0.1 second and lower showed some loss of resolution in this stat. |
let mb_s = (bs.bytes * iter_s) / 1_000_000; | ||
// use iterations per 100s for better resolution in mb_s. | ||
let iter_per_100s = 100 * 1_000_000_000 / ns_iter; | ||
let mb_s = (bs.bytes * iter_per_100s) / 100 / 1_000_000; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why don't we simply compute
// let mb_s = bs.bytes * (1_000_000_000 ns/s / 1_000_000 MB/B ) / ns_iter;
let mb_s = bs.bytes * 1_000 / ns_iter;
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indeed, that seems good. I don't think we have to worry about overflow, no reason not to do this.
MB/s was based on the number of iterations performed in a second, when the iteration duration nears 1 second (1e9 ns), the resolution of the MB/s stat decreases.
add3522
to
627829b
Compare
Updated the commit to use @ranma42's suggestion |
@bors r+ Seems legit |
📌 Commit 627829b has been approved by |
test: Increase resolution of MB/s stat for bench runs close to 1 second MB/s was based on the number of iterations performed in a second, when the iteration duration nears 1 second (1e9 ns), the resolution of the MB/s stat decreases.
test: Increase resolution of MB/s stat for bench runs close to 1 second
MB/s was based on the number of iterations performed in a second, when
the iteration duration nears 1 second (1e9 ns), the resolution of the
MB/s stat decreases.