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.
:)

-Justin

$ ../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
Compilercheck: mtime
Compression: off
Hardlink: off
Nostats: off

* 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)

* patched
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

Attachment: diff
Description: Binary data

_______________________________________________
ccache mailing list
ccache@lists.samba.org
https://lists.samba.org/mailman/listinfo/ccache

Reply via email to