[ccache] Why not cache compile failures?

Joel Rosdahl joel at rosdahl.net
Sun Nov 4 05:21:28 MST 2012

On 24 September 2012 10:44, Andrew Stubbs <ams at codesourcery.com> wrote:
> On 22/09/12 13:13, Joel Rosdahl wrote:
>> I would be OK with caching failures if it's off by default and doesn't
>> affect the default's performance. Have you thought about how to store
>> the exit code in the cache?
> The simplest way would be a tiny file in the cache that just contained the
> code. Say with extension ".error".
> I'd prefer it to be on by default

One reason for having it off by default is that it will decrease
performance, especially on NFS, to let ccache stat a .error file in
the cache for each compilation. Side note: I have previously toyed
with an idea to store a compilation result as a single file in the
cache instead of up to three different files (as it's done currently)
to potentially improve performance (this will make the hardlink mode
impossible, however).

Another reason is that I feel that there are many subtleties about
when a result can be reliably cached, as discussed in this mail thread

> if only to prevent other devs breaking it, but that's your decision to make, of course.

That's what automatic test cases are for. :-)

>> Printing an extra warning message would break ccache's transparency,
>> but perhaps that would be acceptable for failures. Have to think more
>> about it.
> [...] Otherwise, I don't know of any cases where scripts check error/warning
> messages beyond whether they exist or not. Since I would have it only emit
> the "warning" when there are already "error" messages, it would only break
> in unusual cases.

Right, that sounds reasonable.

-- Joel

More information about the ccache mailing list