Class Central is learner-supported. When you buy through links on our site, we may earn an affiliate commission.

YouTube

C++20's Likely Attribute - Optimizations, Pessimizations, and Unlikely Consequences

CppCon via YouTube

Overview

Save Big on Coursera Plus. 7,000+ courses at $160 off. Limited Time Only!
Explore the intricacies of C++20's [[likely]] and [[unlikely]] attributes in this CppCon conference talk. Dive deep into branch prediction, optimizations, and pessimizations while learning the art of benchmarking. Investigate the meaning of these attributes, the risks associated with their use, and whether they're worth implementing. Gain valuable insights into performance tuning and discover how to focus efforts on elements that truly impact performance. Benefit from the expertise of Amir Kirsh and Tomer Vromen as they guide you through topics such as code layout, CPU predictors, early returns, exceptions, and actual benchmarks. Enhance your understanding of C++ performance optimization techniques and learn to make informed decisions when using these new language features.

Syllabus

Introduction
Why do we need it
Code Layout
Bench Predictor
CPU Predictor
Cold Branch
Indirect Branch
Likely vs unlikely
Early return
Exceptions
Likely unlikely macro
Actual Benchmark
Comparison
The Benchmark
The Result
Switching Order of Declaration
Why are they the same
Benchmark
Perf
Summary
Questions
Syntax placement
If is unlikely
Bad Hints
Predictors
Not Optimal

Taught by

CppCon

Reviews

Start your review of C++20's Likely Attribute - Optimizations, Pessimizations, and Unlikely Consequences

Never Stop Learning.

Get personalized course recommendations, track subjects and courses with reminders, and more.

Someone learning on their laptop while sitting on the floor.