Practical Production-Proven Constexpr API Elements
summary
A production C++ library (published on GitHub, built with Bazel) implements MBO library techniques to move runtime containers into constexpr: uninitialized scratch unions, optional destructor suppression, and placement construction to create limited_vector/limited_set/limited_map that are compatible with STL idioms. Code generation uses Python templates and clang-format; experiments use Compiler Explorer and Loop unrolling (up to 32) for an optimized index_of. Deployment touches ~33% of hot code and yields a 1% overall improvement (≈3% effective), with many microbenchmarks showing STL sometimes remains faster and Apple M2 cache behavior surprising.
AI-written summary · about
chapters (14)
- 0:00constexpr API elements
- 1:31constexpr in production
- 4:00C++ constexpr limits
- 6:31constexpr functions basics
- 13:02constexpr examples and pitfalls
- 20:09Hash functions constexpr
- 24:24constexpr constructors
- 27:32Containers memory constraints
- 32:12constexpr-compatible containers
- 39:51Production use cases
- 53:44Limited vector implementation
- 1:01:15Limited set and map
- 1:04:06Deployment performance
- 1:12:13Q&A
related talks
56m“High Performance Code 201: Hybrid Data Structures"
01h 00m“Constexpr Everything” - The Standard Library, Microkernel, Apps, and Unit Tests
32mC++ Standard Library "Little Things”
36mInterfaces Matter
01h 01mRethinking the Way We Do Templates in C++
59mStrongly Typed Containers
55mBreaking Dependencies: Type Erasure - The Implementation Details
37mEnhancing STL containers
