What Can Compiler Benchmarks Reveal About Metaprogramming Implementation Strategies
summary
Builds a portable single-header metabench that generates millions of unique type permutations, runs on C++17 and C++20, and times compile cost via external tools (unix time) after returning a type hash. Uses supercomputer runs to sweep parameter space. Finds concrete numbers: tuple reimplementation cuts GCC compile time by ~3× (clang even more), Intel often times out, and type-based metaprogramming trades memory for speed versus slower function-based approaches. Results guide which templates, lambdas, concepts, and value tricks actually reduce compile-time.
AI-written summary · about
chapters (24)
- 0:00Introduction
- 1:17The Question
- 3:21Context
- 5:05Metaprogramming
- 6:21Requirements
- 8:35Challenges
- 9:20Strategy
- 10:26Type sequence
- 15:03Type Trees
- 15:54args
- 17:24How to implement
- 23:07How to access them
- 24:32Packs
- 28:59Array Structure
- 33:34Meta Functions
- 37:52Compute Parmentation
- 42:17Compute Example
- 45:17Reference Timing
- 47:09Tuples
- 50:03Performance Comparison
- 52:52TypeBased vs FunctionBased
- 54:00Memory Consumption
- 55:14Conclusion
- 57:16Questions
related talks
55mHow bad is meta-programming still today?
23mFunctional Programming in C++ (Run time vs Compile time types)
01h 00mJust-in-Time Compilation
02h 02mPeering forward: C++'s next decade
01h 03mHidden Overhead of a Function API
01h 39mKeynote - C++ Metaprogramming: evolution and future direction
01h 03mto pass and return, the story of functions, values and compilers
54mCompile-Time Validation in C++ Programming
