~/talk

C++20’s [[likely]] Attribute - Optimizations, Pessimizations, and [[unlikely]] Consequences

Talkat CppCon 2022 · 2022-09-11..09-16· [web-performance]
links:none on file
slides:none on file

C++20’s [[likely]]/[[unlikely]] changes only when the compiler actually alters code layout or emits different assembly: it affects the compiler branch predictor and can move hot code to reduce instruction-cache misses, but it does not directly change CPU branch predictors on most architectures. Behavior differs by compiler (GCC is aggressive, clang often ignores), compiler flags and linking, and even an identical code folding bug can erase differences. Measure on real inputs and check the generated assembly and perf counters before trusting hints.

AI-written summary · about

  1. 0:00Introduction and background
  2. 1:55Attributes in C++20
  3. 4:12Compiler specification
  4. 5:24How compilers use hints
  5. 8:08Instruction cache impact
  6. 8:41Switch case analysis
  7. 12:18Branch prediction mechanics
  8. 17:13Hardware hint limitations
  9. 18:24Loop optimization example
  10. 22:16Compiler differences
  11. 25:12Exceptions and Kernel code
  12. 30:04Benchmarking challenges
  13. 34:08Compiler bugs and isolation
  14. 37:05Perf tool analysis
  15. 38:44Summary of findings
  16. 42:19Future improvements
  17. 45:27Q&A session
~/search
type to search 6,249 conferences, 138,987 speakers and 185,172 talks
~/help
cmdctrl k
search every conference, speaker and series
/
focus the filter search
h
home
c
conferences
s
speakers
e
series
t
light / dark — the status bar button does the same
?
this help
esc
close this, then clear every filter — or just the search, while you are typing in it

Ignored while you are typing. Pages without a filter rail have no search to focus.