[ccache] Duplicate object files in the ccache - possible optimization?
joel at rosdahl.net
Wed Nov 9 00:08:19 MST 2011
On 8 November 2011 23:18, Frank Klotz <frank.klotz at alcatel-lucent.com> wrote:
> On 11/08/2011 01:49 PM, Joel Rosdahl wrote:
>> It doesn't sound like a good idea to me, at least, since you would need to
>> store duplicate copies of the object file for two compilations where the
>> source content is the same but the file names differ.
> 1: Would that EVER happen? (I am having trouble visualizing a situation where
> this would be a good thing.)
Don't know, but yes, it's probably quite rare.
> 2: If it DID happen, rather than 2 copies, could store one inode with 2
> directory entries (hard links) with the 2 names.
I don't think you can in an acceptable way find an existing file to reuse when
you're about to store a new file -- you'll have to list the directory and
iterate through its items to look for a reusable file. (That is, unless you
introduce some kind of higher-level index that makes it possible to efficiently
list existing files with a given hash.)
More information about the ccache