On "simple" Optimizations
summary
Uses Compiler Explorer to show clang and GCC generating huge code for four push_backs then collapsing to a simple sum only after adding v.reserve(4) or running extra LLVM passes. Claims and shows that the issue is the inliner and optimizer behavior not the idea of examples — LLVM inlines three but not four functions so a call remains unless capacity is reserved or extra optimization iterations are forced, and the live demo proves the surprising numeric cutoff.
AI-written summary · about
related talks
01h 05mThe Most Important Optimizations to Apply in Your C++ Programs
57mLLVM Optimization Remarks
01h 50mUnderstanding Compiler Optimization
01h 03mHidden Overhead of a Function API
04mZero-Overhead Compiler Pessimization
01h 03mto pass and return, the story of functions, values and compilers
01h 03mUnlocking the value of C++20
42mFaster programs with your compilers autovectorization feature
