[ccache] Ccache prefetch

Andrew Stubbs ams at codesourcery.com
Mon May 12 02:44:21 MDT 2014

On 11/05/14 06:11, Ian Albany wrote:
> IO. Has anyone ever played with preloading the cache into the VFS
> cache ie. RAM as opposed to disk. I have loads of ram and when
> building say the linux kernel, I can start the build an in the
> background read the ccache from one disk and the headers and c files
> using a simple script much in the same way as the preload mechanism
> works for booting some linux systems. But I think that there is also
> some history based on previous usage, so the question is, has anyone
> implemented a second level cache preload?

The problem with this idea is that ccache is only ever executed when you 
run a compile job, and at that time it is in the critical path of your 
build so it must do that absolute minimum to get the job done.

However, you could prime the caches yourself, perhaps.

A simple grep, or md5sum, or something, over the cache directory will 
load all the files into memory.

If you have a large cache directory and only want to load some of it 
into RAM then perhaps a "find .ccache -anewer somefile" to find any 
cache files newer than a file you created previously (unfortunately find 
does not appear to provide a way to do that numerically). A source file 
you modified just before a recent full build would probably be an 
appropriate reference point.

Hope that helps


P.S. for maximum build performance, I would recommend mounting your 
volumes with "noatime", which defeats the above suggestion. It's a problem.

More information about the ccache mailing list