-
Notifications
You must be signed in to change notification settings - Fork 13.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Benchmark times should not display all significant figures. #10953
Comments
This is still an issue, but here's a new version of the example that compiles:
|
Testcase update once more to current rust nightly #![feature(test)]
extern crate test;
use test::Bencher as BH;
macro_rules! mk_benches {
( $($name:ident, $n:expr;)* ) => {
$(
#[bench]
fn $name(bh: &mut BH) {
bh.iter(|| for _ in 0u64..$n { test::black_box(1); } );
}
)*
}
}
mk_benches! {
a, 1;
b, 40; // to get a meaningful time
c, 100;
d, 1_000;
e, 10_000;
f, 100_000;
g, 1_000_000;
h, 10_000_000;
i, 100_000_000;
} |
bluss
pushed a commit
to bluss/rust
that referenced
this issue
Jun 9, 2015
Example display: ``` running 9 tests test a ... bench: 0 ns/iter (+/- 0) test b ... bench: 52 ns/iter (+/- 0) test c ... bench: 88 ns/iter (+/- 0) test d ... bench: 618 ns/iter (+/- 111) test e ... bench: 5,933 ns/iter (+/- 87) test f ... bench: 59,280 ns/iter (+/- 1,052) test g ... bench: 588,672 ns/iter (+/- 3,381) test h ... bench: 5,894,227 ns/iter (+/- 303,489) test i ... bench: 59,112,382 ns/iter (+/- 1,500,110) ``` Fixes rust-lang#10953 Fixes rust-lang#26109
bors
added a commit
that referenced
this issue
Jun 9, 2015
test: Display benchmark results with thousands separators Example display: ``` running 9 tests test a ... bench: 0 ns/iter (+/- 0) test b ... bench: 52 ns/iter (+/- 0) test c ... bench: 88 ns/iter (+/- 0) test d ... bench: 618 ns/iter (+/- 111) test e ... bench: 5,933 ns/iter (+/- 87) test f ... bench: 59,280 ns/iter (+/- 1,052) test g ... bench: 588,672 ns/iter (+/- 3,381) test h ... bench: 5,894,227 ns/iter (+/- 303,489) test i ... bench: 59,112,382 ns/iter (+/- 1,500,110) ``` Fixes #10953 Fixes #26109
flip1995
pushed a commit
to flip1995/rust
that referenced
this issue
Jun 30, 2023
…trigger_on_expect, r=dswij [`missing_panics_doc`]: pickup expect method close rust-lang#10240 *Please write a short comment explaining your change (or "none" for internal only changes)* changelog: [`missing_panics_doc`]: pickup expect method
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Compiled with
rustc -O --test
(using a rustc with #10952) showsThe long numbers are hard to read, and most of the digits are unnecessary. It would be clearer if we only showed a fixed precision, e.g., using engineering notation:
This specific notation has the advantages of easy local comparison, that is, tests that take approximately the same amount of time can easily be compared without accidentally missing
8.0e3
vs1.0e4
(8e3
vs10e3
under the proposed scheme).This could also be achieved by changing the units (i.e.
ns
->us
->ms
), but I personally think that that difference is more subtle than necessary, but I don't have a particularly strong opinion on it.The text was updated successfully, but these errors were encountered: