-
Notifications
You must be signed in to change notification settings - Fork 18k
A strange question for bool #39059
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
Comments
When you are down to a few nanoseconds per operation, it could be the exact alignment of the code in memory, it could be the CPU's memory caching algorithm, it could be the branch predictor, it could be the phase of the moon. Microbenchmarking is hard. We don't use the issue tracker to discuss issues like this. Use a forum instead. If you identify a problem in the compiler or assembler or linker, then by all means open an issue with details. But the odds are that this is effectively chance, and not something that can be fixed. |
Might be #35881 |
After a lot of testing, I have determined that it is not a memory alignment or cpu cache problem. And the results of repeated tests are the same, is this not strange? |
I’d be suspicious of that benchmark, I think the compiler is optimising always some or all of the code under test. |
Please use a forum, as described at https://golang.org/wiki/Questions. Thanks. |
BenchmarkBSFalse-6 502713746 7.17 ns/op 0 B/op 0 allocs/op
BenchmarkBSTrue-6 1000000000 2.17 ns/op 0 B/op 0 allocs/op
all false consume more time than all true, why?
The text was updated successfully, but these errors were encountered: