-
Notifications
You must be signed in to change notification settings - Fork 17.8k
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
testing: benchmarks are context-sensitive #7920
Labels
Comments
Can you see if the generated code for the benchmark is the same in both cases? It's possible that what you are seeing is the effect of crossing instruction cache lines in a tight loop. If that is indeed the case there isn't much the compiler or the testing framework can do, except serve as a cautionary tale for authors of microbenchmarks. On the other hand, if the code changes, then there is probably a bug. Labels changed: added repo-main, release-go1.3maybe. |
In that case I don't see what can be done on the Go side. I'd be happy to hear suggestions, but basically this is a microbenchmark of trivial code for which the loop and function call overhead dominate. It is presumably sensitive to the exact code alignment. Labels changed: added release-none, removed release-go1.3maybe. Status changed to Unfortunate. |
Unrolling 8x here causes the delta to shrink. Instead of 1.08 to 0.81 (-25%), it is 0.81 to 0.74 (-10%). It's hard to be sure that this is attributable directly to the unrolling and not to new code alignment, but it does appear to help. And unrolling is good for reducing benchmark overhead anyway. The question then is whether it's worth the ugliness to do by hand, in the short term. |
CL https://golang.org/cl/91850043 mentions this issue. |
This issue was closed.
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
The text was updated successfully, but these errors were encountered: