Skip to content
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

Papercuts with #[bench] #7655

Closed
catamorphism opened this issue Jul 8, 2013 · 4 comments
Closed

Papercuts with #[bench] #7655

catamorphism opened this issue Jul 8, 2013 · 4 comments

Comments

@catamorphism
Copy link
Contributor

  1. #[bench] functions that have the wrong type signature get silently ignored. This should be an error.
  2. Running a compiled thing with #[bench]s in it yields:
running 1 test
test g ... bench: 16 ns/iter (+/- 0)
result: ok. 0 passed; 0 failed; 0 ignored

The last line (0 passed/0 failed/0 ignored) is confusing here, since it did run something.

  1. I don't think there's much documentation of #[bench] -- specifically that you have to compile with --test and run with --bench.
@pnkfelix
Copy link
Member

visiting for triage, email from 2013 sep 09. I agree, the above problems do indeed look like papercuts.

@pnkfelix
Copy link
Member

also, it might be nice if the benchmark output right-aligned the decimal points in the numbers, for ease of quick comparison by eye.

Doing the above in full generality is probably not worthwhile, since it requires knowing how many digits the maximal output has before you present any results. (It also requires knowing the longest test name, but that is easier to predict accurately. ;)

But even just guessing a reasonable value for the max number of digits for ns/iter, e.g. 9 or 10, and then using that for format width padding, would be step forward.

bors added a commit that referenced this issue Oct 14, 2013
…crichton

r? anyone.

You can see a bit more discussion on #7655.

This does not close any ticket; I am just scratching an itch.  Note in particular that I picked the value `{:>9} ns/iter` pretty much out of a hat.  :)
@pnkfelix
Copy link
Member

Also, the presentation of 0 ns/iter for benchmark runs that actually timed out is a pretty serious papercut; see for example discussion on #9653

@emberian
Copy link
Member

The testing guide now has docs. The new result line is test result: ok. 0 passed; 0 failed; 0 ignored; 1 measured. I've opened #12997 for the typechecking thing, closing.

flip1995 pushed a commit to flip1995/rust that referenced this issue Sep 28, 2021
Fix derivable impl false positives

fix rust-lang#7654
fix rust-lang#7655

changelog: none (not released)
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

No branches or pull requests

3 participants