News: 0001604306

  ARM Give a man a fire and he's warm for a day, but set fire to him and he's warm for the rest of his life (Terry Pratchett, Jingo)

Pre-Compiled Headers Being Debated For LLVM/Clang To Speed-Up Build By 1.5~2x

([LLVM] 3 Hours Ago LLVM Clang Build Speed)


LLVM developers and other stakeholders have begun debating the use of pre-compiled headers "PCH" as a means of speeding up the compiulation of the LLVM compiler infrastructure by 1.5x to 2x than with non-PCH builds.

A request for comments (RFC) pull request was [1]opened last week over using pre-compiled headers to speed-up the LLVM build. Due to most time in LLVM builds being spent repeatedly parsing headers, PCH is being considered for frequently used header files like the C++ standard library, IR, and code generation headers. C++ modules didn't help build times and destroyed parallelism performance and thus pre-compiled headers are being considered to allow for more quickly building LLVM. With pre-compiled headers you are basically archiving the parsed header files already lowered into an intermediate representation (IR) for quicker re-use during the build process.

Leveraging pre-compiled headers for building LLVM has been found to speed-up the build time by 1.5~2x. That's significant time savings considering [2]LLVM Discourse thread was started for discussing whether to use pre-compiled headers by LLVM and if so whether it should be the default or not, among other topics. At this point it isn't clear how this discussion will end for LLVM's proposed use of pre-compiled headers.



[1] https://github.com/llvm/llvm-project/pull/173868

[2] https://openbenchmarking.org/test/pts/build-llvm#results>how long it takes to build LLVM even on larger CPUs</a>.

<br />

<br />This isn't a straight-forward solution though as with pre-compiled headers, regular builds may fail in case of missing includes that are ultimately masked by the presence of PCH. There is also the possibility of other build breakage to occur or other incompatibility differences between PCH and non-PCH builds.

<br />

<br />For soliciting more feedback and discussion, an <a href=



How should I know if it works? That's what beta testers are for. I
only coded it.
-- Attributed to Linus Torvalds, somewhere in a posting