November 4, 2025
Header Wars: Squid vs PCH
Precompiled headers and why Squid won't be using them (2023)
Squid says no to precompiled headers — devs go off
TLDR: Squid tested precompiled headers, got ~5% faster builds but messy tooling, so they’re not adopting them. The comments explode: anti-Clang snark, warnings about memory bloat and hidden dependencies, plus a camp claiming CMake handles PCH fine and a question about future C++ modules.
The Squid web proxy team tried precompiled headers—think a shortcut that reuses common code to speed up builds—and found only a modest ~5% boost plus lots of toolchain drama. Their verdict: not worth it. And that’s when the comments turned into a tech soap opera, complete with a Blazing Saddles gif and popcorn. The spiciest take? o11c called out “inaccuracies” and dunked on Clang, declaring you shouldn’t use it in production, igniting a compiler fan war. NickGerleman brought the cautionary tales: giant all-in-one headers make projects bloated, confuse humans and code editors, and “faster builds” can mean way more memory. On the flip side, mayoff delivered the pragmatic twist: “I hate CMake, but it does this well,” claiming a one-liner made PCH work across Mac and Linux for a Godot plugin. Meanwhile, a curious voice asked if modern C++ modules—basically headers’ grown-up replacement—could solve the mess. The vibe? Split between “ditch the hack,” “use the right tools,” and “wait for modules.” Squid’s stance stays cautious, but the community is having a field day deciding whether speed is worth the headaches. Read the original on the Squid blog.
Key Points
- •Precompiled headers cache parsed headers to reduce repeated work across C++ compilation units.
- •GCC uses .gch files generated with -x c++-header and automatically applies them when present.
- •Clang uses .pch files created with -x c++-header -emit-pch and requires -include-pch; only one PCH can be included at the beginning of a translation unit.
- •Squid’s structure (mandatory inclusion of squid.h) leads to parsing 206 headers per source file across over 800 files, suggesting potential PCH benefit.
- •Tests show ~5% build-time improvement with GCC PCH, but poor integration with the autotools toolchain leads Squid to not adopt PCH.