Expect(optimized)
summary
Method uses compiler attributes to mark function start/end, prevents reordering, compiles and dumps machine code, then compare instruction size between a baseline lambda and the optimized candidate; if candidate size is <= baseline it counts as optimized. Works with lambdas and defaults baseline deduction so simple UB examples (integer overflow) and a regex-expression library case both verify optimization. Requires only a few lines of code and the compiler output, no external tools, and yields deterministic size checks.
AI-written summary · about
related talks
01h 30mDangerous Optimizations in C and C++ Programming Languages
01h 30mTuning C++: Benchmarks, and CPUs, and Compilers! Oh My!
01h 37mAn Overview of Program Optimization Techniques
45mPerformance Benchmarking with Celero
01h 27mDangerous Optimizations! in C++ - Part Deux
01h 03mHigher order functions for ordinary C++ developers
24m(Ab)using Compiler Tools
49mAn Engineering Approach to Optimising C++
