3 ms·
Similar to ABSL_PREDICT_FALSE: https://github.com/abseil/abseil-cpp/blob/master/absl/base/optimization.h#L174 https://github.com/abseil/abseil-cpp/blob/master/a
by wffurr 7y ago
Similar to ABSL_PREDICT_FALSE: https://github.com/abseil/abseil-cpp/blob/master/absl/base/optimization.h#L174 https://github.com/abseil/abseil-cpp/blob/master/absl/base/o...
- dgellow 7y agoInteresting. From the comment in abseil's implementation: // Compilers can use the information that a certain branch is not likely to be // taken (for instance, a CHECK failure) to optimize for the common case in // the absence of better information (ie. compiling gcc with `-fprofile-arcs`). // // Recommendation: Modern CPUs dynamically predict branch execution paths, // typically with accuracy greater than 97%. As a result, annotating every // branch in a codebase is likely counterproductive; however, annotating // specific branches that are both hot and consistently mispredicted is likely // to yield performance improvements.