[CMake] Compilation speed with CMake/NMake combination, making it faster?

Eric Noulard eric.noulard at gmail.com
Wed Dec 12 16:13:15 EST 2007


2007/12/12, Jesper Eskilson <jesper at eskilson.se>:
> Eric Noulard wrote:
> > I'm not a big MS Platform user but I like the idea
> > of compilation speed-up very much.
> >
> > I personnally use ccache (http://ccache.samba.org/)
> > on Linux + gcc and there is x2 up to x4 _SPEEDUP_
> > (when recompiling since initial compilation is slower)
> > on a C++ project with 50+ files with moderate template usage.
>
> Yes, recompiling goes faster, but if you actually have made any changes
> to the source code (which is often the case when you're compiling ;-))
> then ccache won't give you anything.

Your experience may be different but I can assure you that
when I'm doing reasonable source code changes I do see
speed-up. The fact is when you've just added a bunch of
functions/method to one (or better several)
 (non-templated) class(es) you
do not change the header file very often but you do
modify the implementation a bunch of time
before you are finally ok with it.
May be it's because I'm not the write once compile once guy :=)

In that scenario (my _current_ common case) I really get noticeable speed-up.
I've never measured it but I did "feel" it very well because
I was  developing in 2 differents places, one with ccache
and the second without it.

I promptly installed ccache on the second when I realised that.

Another ccache-winning scenario is when you are in the process
of "releasing" your
software, most of the time I'm doing almost 2,3,4... builds before
I get the final released one.
Most of the time I do recompile from scratch even if
it was a packaging issue (i.e. no source modification).

> Most people I've seen claim that ccache is useful are people who are
> stuck with a build system with broken dependencies who need to do "make
> clean" a lot. ;-)

I'm using CMake + Unix Makefile generator.
I don't think it has so broken dependencies or has it? :=)

> Actually, ccache comes in its best light when you can use it for sharing
> build-results.

I did not experienced that but for myself,
I usually have several source/tree and build/tree for differents
version of the same software.

one tree for common dev
one tree for testing foreign patch
one tree for release
...

Those different trees shares the ccache cache.
I think it saves me a lot of header preprocessing.

Those are just comments for my own use case.
I'm not trying to convince anybody that ccache is a "must have"
but I now think it's worth trying.

-- 
Erk


More information about the CMake mailing list