[ccache] Duplicate object files in the ccache - possible optimization?

Joel Rosdahl joel at rosdahl.net
Wed Nov 9 00:15:01 MST 2011


> On 11/08/2011 02:24 PM, Joel Rosdahl wrote:
>>
>> On 7 November 2011 18:49, Frank Klotz<frank.klotz at alcatel-lucent.com>
>> wrote:
> I guess I would ask/suggest that it be made clearer that the 'data structure
> called “manifest”' is just another file in the cache, named with its hash and
> the suffix ".manifest"; and also that the "references to cached compilation
> results" in the manifest files ARE the proprocessor hashes

Thanks, I'll add some note about this.

> It's good to know that any object file stored in the cache IS
> identified/named by the hash of its preprocessor output - the direct mode is
> just a quick way to decide that the given set of source files would get the
> same preprocessor output if cpp were actually run. (Am I starting to get it
> now?)

Yup!

>> If there are multiple object files in the cache with the same content, then
>> that's because different preprocessor outputs have resulted in identical
>> object files.
>
> Hmmm. Shouldn't that be hard to do? Evidently it's not, given that 30% of the
> files in my cache have twins (or triplets or whatever). Ok, so it's not so
> hard as that - while unused macros and constants are dropped during
> preprocessing, unused structure definitions and other language constructs
> cannot be, so I guess it is not so hard after all to create different
> preprocessed files which generate identical .o files.

Another common change that will result in identical .o files is changing a
local variable name (when not compiling with debug info).

-- Joel


More information about the ccache mailing list