On Mon, 26 Oct 2026 22:23:12 GMT, Benjamin Peterson <[email protected]> wrote:
> Add `-fpch-instantiate-templates` to the clang precompiled header generation > command. > > Testing with `make hotspot`, I observe a 40% reduction in build CPU time for > a release build. On a 56 core machine, this reduces the wall time of the same > command by 25% (45.94s -> 34.5s). > > > > > --------- > - [x] I confirm that I make this contribution in accordance with the [OpenJDK > Interim AI Policy](https://openjdk.org/legal/ai). The wins are certainly good, but since it changes when templates are instantiated, I do believe it can introduce subtle compilation errors that would only show up on Clang and in some future code shapes. This compiler-specific behavior is annoying. So I would say we should consider switching this on when more compilers -- thinking GCC -- are able to do this trick, to give us more consistent coverage. Last time I checked, most of the template instantations were from `access.hpp` and friends. A bit better course of action for improved build times might be understanding if there are possibilities to curb template where it makes sense. Since it IMO helps local development loops first and foremost, it would make sense to add some developer docs for the options they could use to improve build times. I have more options besides PCH, like `--with-native-debug-symbols-level=1` :) ------------- PR Comment: https://git.openjdk.org/jdk/pull/33576#issuecomment-6437513805
