PATCH: distcc and ccache speedup: adds directives-only preprocessing

Ollie Wild aaw@google.com
Mon Mar 26 23:08:00 GMT 2007


It's been about a month since I posted this patch so I wanted to send
out another reminder.  The patch submission is at
http://gcc.gnu.org/ml/gcc-patches/2007-02/msg02178.html.


Here's a refresher summary:

This patch decreases distcc build and ccache lookup times by providing
an optimized "directives-only" preprocessing mode.

Distcc improves build performance by preprocessing files locally,
transmitting the preprocessed code to one or more remote build
servers, and performing compilation on the remote servers.  In
practice, the time to preprocess files locally is the limiting factor
in further reducing build time.  This patch adds a -fdirectives-only
flag which instructs the preprocessor to treat directives normally but
bypass tokenization of other preprocessing tokens.  Additional
preprocessing, such as macro expansion outside of directives, is
performed during the compilation phase.

Ccache reduces recompilation time by caching the results of previous
compilations and detecting when a compilation is repeated.  It
generates a lookup key from the preprocessed source code.  The
-directives-only flag improves lookup performance by reducing key
generation time.

For a typical c++ file, the new option reduces preprocessing time by
about 30%.  This in turn results in a similar decrease in overall
distcc build and ccache lookup times.

Usage is straightforward.  The -fdirectives-only flag is simply added
to the compiler options passed to distcc or ccache.

Tested with a C/C++ bootstrap and testsuite run on i686-pc-linux-gnu.
Validated two-stage processing by rerunning the C/C++ testsuites with
xgcc and g++ replaced by scripts which invoke ccache.

Ollie



More information about the Gcc-patches mailing list