Some ccache benchmarking

Volker Simonis volker.simonis at
Fri Apr 19 16:54:58 UTC 2013

+1 for C

Another nice side effect of option C would be that the 'no precompiled
headers' build would be automatically used more often. This would eliminate
a lot of small but nasty dependency problems which are introduced from time
to time because apparently everybody is only building with precompiled
headers (and precompiled header usage tends to hide these problems).

And option C would also not introduce yet another flag to the build which
is only familiar to people who know the gcc man page by heart:)


On Fri, Apr 19, 2013 at 12:10 PM, Erik Joelsson <erik.joelsson at>wrote:

> Hello,
> In the new build, on Linux, configure tries to pick up and use ccache if
> available on the machine. It is even being picky about the version (3.1.4
> minimum) to make sure that precompiled headers are supported, since those
> are used in the hotspot build. I have looked into this precompiled header
> support in ccache some and have some insights to share. The trigger for
> this was observing that building hotspot with an empty ccache took a very
> long time compared to not using ccache at all.
> Looking at the ccache manual, for precompiled headers to actually be used,
> the gcc flag -fpch-preprocess needs to be added to the command line. What
> it does is enabling precompiled headers when running gcc in preprocess only
> mode, which ccache needs to do in order to create the hash for the cache. I
> have experimented with adding this flag to see what performance differences
> it would yield. As a second option, I've also tried disabling precompiled
> headers completely. Here is a summary of the results from running on my
> machine (Ubuntu 10.10 x86_64 8 cores):
> Summary                    no ccache   empty cache   full cache
> without -fpch-preprocess   2:42        5:28          1:07
> with -fpch-preprocess      2:43        3:27          1:32
> no precompiled headers     3:32        3:47          0:54
> Adding the flag reduces the compilation time with an empty cache
> tremendously. However, it also increases the compilation time with a full
> cache significantly. Disabling precompiled headers completely when using
> ccache also reduces time with the empty cache, though not as much. It does
> however speed up compilation with a full cache even more than any of the
> other options.
> My conclusion is that the current situation is bad and needs to be
> improved. Either of the methods tested will be an improvement. Here are the
> options as I see them:
> A. Add -fpch-preprocess to CFLAGS permanently in hotspot.
> B. Have configure add -fpch-preprocess if ccache is used.
> C. Have configure disable precompiled headers if ccache is used. This also
> removes the current version requirement of 3.1.4 on ccache for precompiled
> header support which is enforced in configure, and would automatically
> (re)enable ccache use in jprt.
> I would lean towards option C, but would be interested in other opinions.
> /Erik

More information about the build-dev mailing list