-
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
Return value/use extra::test::black_box in benchmarks that are optimised to nothing #12118
Comments
I'm tagging this easy because I think it should be relatively easy to choose a few benchmarks from the list above to progressively fix. And mentor because I'm very happy to assist. (Some of the benchmarks above may not be dead-code eliminated, but never the less are so small that the benchmarker doesn't have enough resolution to give meaningful results: changing it to something like |
Could I take this issue? |
Sure! (Don't feel required to do all of them at once.) |
#12212 reduced the list to
And I think everything except the |
I think most of those are fixed by now. There are only a few left in I'll prepare a pull request. |
This makes sure that the benchmarked code does not get optimized away. Also fixed a typo. Fixes rust-lang#12118.
Fixes #12118. (I sneaked in an unrelated one-character whitespace fix I spotted while reviewing some benchmarks, if that is not okay, I can create a separate pull request for that.)
style: rename crates to kebab-case Ref: rust-lang#12102 I updated all the folders names as well as the crates names in each `Cargo.toml` to use kebab-case. This is my first ra PR. In case I missed something, I am ready/available to fix it until it is ready to merge. Thank you.
As #8261 describes one has to be careful with benchmarks to avoid them being optimised to remove the section of code that's actually of interest; many in tree benchmarks are not this careful.
#12105 adds two ways to get around this:
Return a value from the closure
Call the noop
extra::test::black_box
function on some result of a calculation, e.g.In both cases, the value is unused, but LLVM can't be sure and so cannot remove optimise out the computation of the value.
The following are the benchmarks that took less than 10ns on the linux-64-opt buildbot (for the landing of #12105), and so are strong candidates for benchmarks that have been optimised to uselessness (there are probably others which aren't completely optimised to nothing, but still aren't benchmarking what they are purporting to):
The text was updated successfully, but these errors were encountered: