user47827: What is ccache? Can you provide some guidance on when to use it for building Bitcoin Core PRs and how to use it?

user47827: ccache is a compiler cache.

It speeds up recompilation by caching previous compilations and detecting when the same compilation is being done again.

Unlike dbcache the decision of how much ccache to allocate is not as critical. The Bitcoin Core productivity doc does recommend that you put something like this in ~/.ccache/ccache.conf:
max_size = 50.0G  # or whatever cache size you prefer; default is 5G; 0 means unlimited

base_dir = /home/yourname  # or wherever you keep your source files


Note: base_dir is required for ccache to share cached compiles of the
same file across different repositories / paths; it will only do this
for paths under base_dir. So this option is required for effective use
of ccache with git worktrees.
You must not set base_dir to "/", or anywhere that contains system
headers (according to the ccache docs).

There doesn't appear to be any obvious downsides to use ccache. But there are a couple of warnings on the ccache site.

Compilers are moving targets. Newer compiler versions may, and often
do, introduce features that ccache can't foresee.

and

The fastest mode (the "direct mode") has a corner case which can result in false positive cache hits.

Generally though it appears you can just install it (as Pieter says) and forget about it and this will save you time on compiling Bitcoin Core PRs.
For other information on speeding up C++ compilation see this excellent blog post from Martin Hořeňovský.

user208: The tool ccache helps store intermediate compilation results, so if you changes branches often, and rebuild, it can significantly speed up doing so.
To use it, you install ccache for your platform. That's it. The Bitcoin Core configure script will detect its presence, and use it automatically.

47827: <p>What is <a href="https://github.com/bitcoin/bitcoin/blob/492cdc56e087c7f51f3d1e3f807191da7f9d9a07/doc/productivity.md#cache-compilations-with-ccache" rel="nofollow noreferrer">ccache</a>? Can you provide some guidance on when to use it for building Bitcoin Core PRs and how to use it?</p>
 47827: <p><a href="https://ccache.dev/" rel="nofollow noreferrer">ccache</a> is a compiler cache.</p>
<blockquote>
<p>It speeds up recompilation by caching previous compilations and detecting when the same compilation is being done again.</p>
</blockquote>
<p>Unlike <a href="https://bitcoin.stackexchange.com/questions/89100/bitcoind-node-crashes-after-using-dbcache-option">dbcache</a> the decision of how much ccache to allocate is not as critical. The Bitcoin Core productivity <a href="https://github.com/bitcoin/bitcoin/blob/492cdc56e087c7f51f3d1e3f807191da7f9d9a07/doc/productivity.md#cache-compilations-with-ccache" rel="nofollow noreferrer">doc</a> does recommend that you put something like this in <code>~/.ccache/ccache.conf</code>:</p>
<pre><code>max_size = 50.0G  # or whatever cache size you prefer; default is 5G; 0 means unlimited

base_dir = /home/yourname  # or wherever you keep your source files
</code></pre>
<blockquote>
<p>Note: base_dir is required for ccache to share cached compiles of the
same file across different repositories / paths; it will only do this
for paths under base_dir. So this option is required for effective use
of ccache with git worktrees.</p>
<p>You must not set base_dir to &quot;/&quot;, or anywhere that contains system
headers (according to the ccache docs).</p>
</blockquote>
<p>There doesn't appear to be any obvious downsides to use <code>ccache</code>. But there are a couple of warnings on the ccache <a href="https://ccache.dev/" rel="nofollow noreferrer">site</a>.</p>
<blockquote>
<p>Compilers are moving targets. Newer compiler versions may, and often
do, introduce features that ccache can't foresee.</p>
</blockquote>
<p>and</p>
<blockquote>
<p>The fastest mode (the &quot;direct mode&quot;) has a corner case which can result in false positive cache hits.</p>
</blockquote>
<p>Generally though it appears you can just install it (as Pieter says) and forget about it and this will save you time on compiling Bitcoin Core PRs.</p>
<p>For other information on speeding up C++ compilation see this excellent blog <a href="https://codingnest.com/the-little-things-speeding-up-c-compilation/" rel="nofollow noreferrer">post</a> from Martin Hořeňovský.</p>
 208: <p>The tool ccache helps store intermediate compilation results, so if you changes branches often, and rebuild, it can significantly speed up doing so.</p>
<p>To use it, you install <code>ccache</code> for your platform. That's it. The Bitcoin Core configure script will detect its presence, and use it automatically.</p>
