dftracer-utils builds with precompiled headers off by default
Context#
CMake precompiled headers (PCH) defeat ccache in wheel builds and Linux gcc builds. ccache hashes the .gch file, which is about 250 MB and differs on every build, so every file that uses the PCH misses. The .gch files also flood the cache: with a 900 MB cap, the per-subdirectory limit of ccache is about 55 MB, so cleanup evicts other entries.
Decision#
DFTRACER_UTILS_ENABLE_PCH defaults to OFF. Pass -DDFTRACER_UTILS_ENABLE_PCH=ON for local builds without ccache.
Why#
Measured in the wheel CI: with PCH on, the cp312 hit rate was 52.8% after cp38. With PCH off, the hit rate was 96.8% and the compile time 0.3 min instead of 3.3 min. A cold first build is about 15% slower without PCH.
PCH also hid a missing include: tree_table_formatter.cpp used std::ostringstream without #include <sstream> and failed to compile once PCH was off. A build without PCH can show other hidden includes; build with -k0 to list them all.
Rejected options#
Keeping PCH on for CI: it keeps the low hit rate and fills the cache.
Also found by searching
- ccache hit rate 52% in wheel CI, .gch precompiled header 250 MB differs every build
- dftracer-utils builds miss the compiler cache and the cache fills up with huge files
- how do I enable precompiled headers in dftracer-utils for a local build, and why is it off
- DFTRACER_UTILS_ENABLE_PCH default, cmake target_precompile_headers ccache eviction
- ccache hit rate is only 52% in wheel CI, precompiled headers .gch 250 MB changes every build
- dftracer-utils build slow on Linux gcc with ccache, every file misses cache
- how do I enable precompiled headers in dftracer-utils local build
- DFTRACER_UTILS_ENABLE_PCH default off why, ccache cap 900 MB evicting entries