Comparison of C++ Performance Optimization Techniques for C++ Programmers
summary
Benchmarks show a custom C++ library (SU/SWAR style) implementing strlen and atoi variants that beats GLIBC consistently, using AVX2/NEON intrinsics and portable SIMD fallbacks. The atoi path is over 3x faster for A2I on tested hardware. Key details: aligned block loads to avoid page-cross faults, lane-wise parallel comparisons to find the first NUL, arithmetic-based digit packing and multiply-add conversion, and minimal branching so object code stays small and the processor’s out-of-order engine does the rest.
AI-written summary · about
chapters (11)
- 0:00Introduction and objective
- 2:42Motivation and benchmarks
- 7:43Benchmark methodology
- 10:26Analyzing natural strlen
- 16:04Advanced implementation techniques
- 24:52Lessons in library design
- 28:08GLIBC codebase critique
- 34:27Compiler explorer analysis
- 38:22Parsing and integer conversion
- 50:16Performance results and patterns
- 55:27Foundational performance principles
related talks
44mFastware
57mWriting Great Libraries: 89 Easy Steps
49mWriting better code with help from Qt and the compiler
01h 00mProgramming with less effort in C++...
42mAdventures in Efficiency and Performance
01h 21mC++ MythBusters
01h 03mDesigning C++ portable SIMD support
59mSoftware Engineering Is About Tradeoffs
