diff options
Diffstat (limited to 'absl/base/optimization.h')
-rw-r--r-- | absl/base/optimization.h | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/absl/base/optimization.h b/absl/base/optimization.h index 6974f1f60777..0dcbef32a3c5 100644 --- a/absl/base/optimization.h +++ b/absl/base/optimization.h @@ -163,6 +163,12 @@ // 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. #if ABSL_HAVE_BUILTIN(__builtin_expect) || \ (defined(__GNUC__) && !defined(__clang__)) #define ABSL_PREDICT_FALSE(x) (__builtin_expect(x, 0)) |