Speed-up PCH builds

Hello,

There’s a pending review, https://reviews.llvm.org/D69585, which greatly speeds up building of codebases using PCH + heavy use of templates.

Previously, template instantiations would only happen at the end of the TU which includes the PCH. I’ve seen codebases with 5+ sec spent in each TU because of this.

With this patch, instantiations are allowed to happen at the end of the PCH, which shaves a few seconds in each TU including the PCH. This behavior is behind a new flag.

It would be much appreciated if anybody knowledgeable of the subject could take a look at this please?

Many thanks in advance!

Alex.

Judging by the lack of responses here, it feels like there aren’t a lot of active stakeholders in clang’s PCH behavior.

It seems pretty clear that there is a performance use case for instantiating templates at the end of the PCH.

I think your plan to land this under a flag sounds good, and then if other users care we can discuss changing the default later.