Rule of Cheese is a collection of Clang compile-time benchmarks based on
ctbench
.
The main goal of this project is to evaluate and compare the compile-time cost of C++ language features such as SFINAE or type alias, thus proving (or busting) C++ compile-time rules of thumb such as the Rule of Chiel.
You might start with pyperf
's system tuning guide to get more accurate
measurements.
mkdir build
cd build
CXX=clang++ CC=clang cmake -G Ninja ../ -DCMAKE_BUILD_TYPE=Release
NB: Using Make will check dependency for each and every of the 2000+ benchmark repetitions, setting you back a minute or two every time you update a graph configuration.
Descending cost of operation (taken from here).
- SFINAE
- Instantiating a function template
- Instantiating a type
- Calling an alias
- Adding a parameter to a type
- Adding a parameter to an alias call
- Looking up a memoized type
- Antoine Morrier
for asking about the performance impact of
if constexpr
case order