Skip to content

test: Increase resolution of MB/s stat for bench runs close to 1 second#30959

Merged
bors merged 1 commit into
rust-lang:masterfrom
bluss:bench-resolution
Jan 17, 2016
Merged

test: Increase resolution of MB/s stat for bench runs close to 1 second#30959
bors merged 1 commit into
rust-lang:masterfrom
bluss:bench-resolution

Conversation

@bluss

@bluss bluss commented Jan 16, 2016

Copy link
Copy Markdown
Contributor

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.

@rust-highfive

Copy link
Copy Markdown
Contributor

r? @aturon

(rust_highfive has picked a reviewer for you, use r? to override)

@bluss

bluss commented Jan 16, 2016

Copy link
Copy Markdown
Contributor Author

You can play with resolution like this: https://play.rust-lang.org/?gist=c56721bbd0fdfb6c090c&version=stable

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.

Comment thread src/libtest/lib.rs Outdated

Copy link
Copy Markdown
Contributor

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;

?

Copy link
Copy Markdown
Contributor Author

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.
@bluss

bluss commented Jan 16, 2016

Copy link
Copy Markdown
Contributor Author

Updated the commit to use @ranma42's suggestion

@Gankra

Gankra commented Jan 16, 2016

Copy link
Copy Markdown
Contributor

@bors r+

Seems legit

@bors

bors commented Jan 16, 2016

Copy link
Copy Markdown
Collaborator

📌 Commit 627829b has been approved by Gankro

Manishearth added a commit to Manishearth/rust that referenced this pull request Jan 17, 2016
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.
bors added a commit that referenced this pull request Jan 17, 2016
@bors bors merged commit 627829b into rust-lang:master Jan 17, 2016
@bluss bluss deleted the bench-resolution branch January 17, 2016 14:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants