STINNER Victor <vstin...@redhat.com> added the comment:

Few more links about likely/__builtin_expect:

* GCC documentation says: "In general, you should prefer to use actual profile 
feedback for this (-fprofile-arcs), as programmers are notoriously bad at 
predicting how their programs actually perform."

  https://gcc.gnu.org/onlinedocs/gcc/Other-Builtins.html

* 
https://softwareengineering.stackexchange.com/questions/188853/how-much-usage-of-likely-and-unlikely-macros-is-too-much

  "If you're writing for x86/x64 (and are not using 20-year-old CPUs), the 
performance gain from using __builtin_expect() will be negligible if any."

* http://blog.man7.org/2012/10/how-much-do-builtinexpect-likely-and.html

  "This optimized version [PGO] runs significantly faster (...) than our 
version that used __builtin_expect()."

  [When __builtin_expect() is misused] "In this case, unsurprisingly, we made 
each check run slower (...)"

* 
https://stackoverflow.com/questions/109710/how-do-the-likely-unlikely-macros-in-the-linux-kernel-work-and-what-is-their-ben

  "Like all such performance optimisations you should only do it after 
extensive profiling to ensure the code really is in a bottleneck (...)"

* https://stackoverflow.com/questions/10922607/gcc-likely-unlikely-macro-usage

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue37774>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to