Ccache depend mode
Luboš Luňák
l.lunak at collabora.com
Tue May 7 09:32:12 UTC 2019
Hello,
ccache 3.6 has introduced a new depend mode (CCACHE_DEPEND), in which ccache
never uses preprocessing (gcc -E), which speeds things up on ccache misses.
Previously ccache used the output from gcc -E to find out all the headers the
source file depends on, in the depend mode it uses the output generated
by -MD/-MMD. With https://gerrit.libreoffice.org/#/c/71629/ I'd like to
enable this by default for LO, if supported by ccache
(with --enable-ccache=nodepend to disable the mode).
The advantages:
- It's faster; especially with PCH enabled:
make slideshow.build clang +ccache+icecream (ccache depend):
non-pch nodepend:
164.42user 18.05system 0:26.82elapsed 680%CPU
non-pch depend:
144.61user 13.37system 0:23.11elapsed 683%CPU
pch nodepend:
142.33user 18.04system 0:25.90elapsed 619%CPU
pch depend:
116.64user 12.10system 0:21.51elapsed 598%CPU
The disadvantages:
- Needs recent ccache. The advantage here is that since it's so new, if there
are problems with it, most people with not-new-enough ccache won't notice.
- There won't be any preprocessed hits. My current ccache statistics are
141256 direct hits and 7153 preprocessed hits, so this doesn't seem to matter
in practice.
- We use -MMD, which exludes system headers (or even our externals, since for
those we use -isystem too). This means that ccache could give incorrect hits
if those headers change. That may seem bad, but I think it's unlikely to
cause problems in practice, for several reasons:
* System headers rarely change.
* If they change, it's generally a binary compatible change.
* If they change in an incompatible way, the sources usually need a change
too.
* Since we use -MMD, our make dependencies ignore such changes as well.
This could be mitigated by switching to -MD, but that'd affect make
performance by blowing up the number of dependencies, which I think is not
worth it.
--
Luboš Luňák
l.lunak at collabora.com
More information about the LibreOffice
mailing list