[ccache] [Patch] Faster direct-mode hash
justin.lebar at gmail.com
Sun Nov 7 14:13:06 MST 2010
This patch is a followup to the discussion in "Questions about two hot
functions in ccache".
On my machine, the patch speeds up direct mode cache hits by about a
factor of 1.7 for the c++_includes.cc test file. My benchmark of
|make clean && time make| in Mozilla's docshell/base went from 1.04s
(git master) to 0.64s, a 1.63x speedup.
Full output from ../perf.py on c++_includes.cc is included below.
I suspect we could use the fast_hash function for preprocessor mode
without much work. I also suspect that switching to a smarter
algorithm for searching for "#include" would decrease the cost of
cache misses. But I haven't profiled either of these cases.
I'm a bit concerned about the fact that I had to change the reported
file lengths in the manifest test (in test.sh). I'm not sure what's
going on here; I may well have messed something up. Hopefully not.
$ ../perf.py -n10 --hit-factor=10 --ccache=../ccache gcc-4.5 c++_includes.cc
Compilation command: gcc-4.5 c++_includes.cc -c -o c++_includes.o
* git master (9cdd1154)
Without ccache: 3.55 s (100.00 %) ( 1.00 x)
With ccache, preprocessor mode, cache miss: 4.16 s (117.10 %) ( 0.85 x)
With ccache, preprocessor mode, cache hit: 0.87 s ( 24.51 %) ( 4.08 x)
With ccache, direct mode, cache miss: 4.22 s (118.98 %) ( 0.84 x)
With ccache, direct mode, cache hit: 0.15 s ( 4.36 %) (22.92 x)
Without ccache: 3.53 s (100.00 %) ( 1.00 x)
With ccache, preprocessor mode, cache miss: 4.13 s (116.90 %) ( 0.86 x)
With ccache, preprocessor mode, cache hit: 0.86 s ( 24.25 %) ( 4.12 x)
With ccache, direct mode, cache miss: 4.15 s (117.55 %) ( 0.85 x)
With ccache, direct mode, cache hit: 0.09 s ( 2.47 %) (40.43 x)
* Speedup: = .15 / .09 = 1.7x
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 11175 bytes
Desc: not available
More information about the ccache