On Tue, Jan 3, 2017, at 06:43 CST, Matthias Maier <
tam...@43-1.org> wrote:
> On Tue, Jan 3, 2017, at 01:45 CST, Jean-Paul Pelteret <
jppel...@gmail.com> wrote:
>
>> Dear all,
>>
>> I've recently become aware of ccache <
https://ccache.samba.org/>, although
>> I have no experience with it whatsoever. Is this something that may benefit
>> us when it comes to recompiling deal.II during development? It looks like
>> it might be quite easy to integrate
>> <
https://crascit.com/2016/04/09/using-ccache-with-cmake/> using cmake
>> <
https://github.com/xbmc/xbmc/blob/master/cmake/modules/FindCCache.cmake>.
>
> Yes, I have used ccache extensively in the past (well as a Gentoo Linux
> user one eventually tries all that stuff). My experience with it is a
> bit dated, though. If you have a fast SSD ccache might be beneficial
> again - a while ago with slower HDDs it was faster to simply compile
> from scartch in a tmpfs.
Due to some recent discussion, I tried ccache again and I totally
changed my opinion.
I set up a ccache backing store on an NVME SSD. With it I get the
following results:
First run:
ninja 7208.87s user 128.74s system 730% cpu 16:44.97 total
Second run:
ninja 45.14s user 8.44s system 298% cpu 17.956 total
Yes, that's 18 seconds instead of 17 minutes.
Further, configuring from scratch improved from 17 seconds to 10
seconds.
If you want to use ccache together with ninja (and for example clang),
create two files:
ccache-clang:
#!/bin/sh
exec /usr/bin/ccache clang "${@}"
ccache-clang++:
#!/bin/sh
exec /usr/bin/ccache clang++ "${@}"
and run configure with
$ cmake -DCMAKE_C_COMPILER="ccache-clang" -DCMAKE_CXX_COMPILER="ccache-clang++" -GNinja ...
Best,
Matthias