The Most Important Optimizations to Apply in Your C++ Programs
summary
Covers concrete, actionable optimizations: LTO and PGO for build pipelines, replacing malloc and using llvm-bolt for binary layout, annotations like noexcept/restrict/assume, and manual SIMD vectorization with AVX intrinsics including a 4x4 matrix multiply example that shows real speedups. Explains tradeoffs, shows compiler-generated intrinsics and cache/predictor pitfalls (false sharing, layout reordering), and recommends benchmarking workflows and CI performance tests rather than blind rules.
AI-written summary · about
chapters (32)
- 0:00Introduction
- 0:30Overview
- 1:03Goals
- 4:44Examples
- 5:44Compiler Optimizations
- 6:25Fast Math
- 7:10Link Time Optimization
- 8:01Unity Builds
- 8:38Linking Statically
- 9:24Profiles
- 10:34Compilers
- 11:36Binary Post Processing
- 12:10C Plus Code
- 15:36Const
- 16:35Global variables
- 17:31No except
- 18:40Static
- 19:39Inline
- 20:48Attributes
- 21:19Likely
- 23:33Assume
- 24:39Restrict
- 26:05Provenance
- 26:52Function Boundaries
- 33:23Exception Handling
- 34:08Value Qualified Member Functions
- 39:32Cache
- 46:19Branch Predictor
- 50:24SIMD
- 51:27Intrinsics
- 53:21Conclusion
- 55:58Questions
related talks
42mFaster programs with your compilers autovectorization feature
01h 50mUnderstanding Compiler Optimization
01h 03mUnlocking the value of C++20
01h 01mWant fast C++? Know your hardware!
49mImprove your C++ with inspirations from other languages
01h 06mUtilize your CPU power
55mC++ 20 Innovations: High-Performance Cross-Platform Architecture in C++
08mOn "simple" Optimizations
