In go standard package src/sync/once.go, a recent revision change the snippets
if atomic.LoadUint32(&o.done) == 1 {
return
}
//otherwise
...
to:
//if atomic.LoadUint32(&o.done) == 1 {
// return
// }
if atomic.LoadUint32(&o.done) == 0 {
...
}
the question is, according to this change, hot path is no longer explicit in the code, does this change has bad impact on branch prediction ? does go compiler make some help in the subsequent run of this function or the whole thing of branch prediction is on cpu?
commit page:https://github.com/golang/go/commit/ca8354843ef9f30207efd0a40bb6c53e7ba86892