[ccache] [RFC] Do manifest_put in a background task.

Andrew Stubbs ams at codesourcery.com
Tue Nov 20 14:51:59 MST 2012

Hi all,

This isn't meant to be a final patch, but more of a starting point up 
for discussion. Before it's a finished patch it'll need some autoconf 
work, some adjustment to the test-cases, and probably a config option to 
turn it off. (Another question is whether to do it on cache miss, as in 
the patch, or in all cases to take the stats update into the background?)

The idea is simple: don't spend foreground time doing work that isn't on 
the critical path.

My profiling (using valgrind --tool=callgrind) suggests that ccache 
spends approximately 10% of its run time running manifest_put, and this 
happens *after* ccache has already acquired all the results the calling 
build needs to continue.

The time isn't wasted, it's an investment in the future, but it's still 
slowing down the current build, and a build with cache-misses is already 
a slow build.

I've done some basic wall-clock benchmarking, and without this patch 
binutils 2.22 takes 2m:39s to build with an empty cache, on my machine, 
compared to 2m:25s if I use this patch. (The measurements were not 
terribly scientific, and repeated runs gave fairly noisy results, but 
those times are fairly representative.)

In addition to just being nice-to-have on its own, this might also open 
up some previously-too-expensive possibilities for fixing the flaws in 
direct-mode caching, or even making improvements.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Do-manifest_put-in-a-background-task.patch
Type: text/x-patch
Size: 983 bytes
Desc: not available
URL: <http://lists.samba.org/pipermail/ccache/attachments/20121120/f3110b14/attachment.bin>

More information about the ccache mailing list