C++20’s [[likely]] Attribute
Optimizations, Pessimizations, and [[unlikely]] Consequences
C++20 added the [[likely]] and [[unlikely]] attributes, which formalize existing compiler builtins. As users of the latest standards, we all want to use them in our code and get better performance - but should we?
In this talk we investigate what these attributes mean, the risk of using them incorrectly (and even the risk of using them correctly!) and whether they’re actually worth the effort. We will dive deep into branch prediction, optimizations and pessimizations, and the art of benchmarking. We will see that in C++ questions that seem simple to begin with do not get a simple answer, but an interesting one!
Participants of the talk will hopefully improve their knowledge of performance tuning, and how to focus efforts in things that really matter for performance.
Amir Kirsh
C++ lecturer at the Academic College of Tel-Aviv-Yaffo and Dev Advocate at Incredibuild. Previously the Chief Programmer at Comverse. Co-organizer of Core C++ conference and a member of the Israeli ISO C++ NB. Currently a visiting researcher at Stony Brook University, New-York.
Tomer Vromen
Software engineer at Dell Technologies, programming in C++ for 10 years. Interested in algorithms, software development, and long distance running.