[ccache] [Patch] Faster direct-mode hash

Anders Furuhed anders.furuhed at pantor.com
Sun Nov 7 14:47:31 MST 2010


Hi,

check_for_temporal_macros could stop searching if both macros have been found?
I cannot tell if doing that would make any real difference.

Regards,
Anders

7 nov 2010 kl. 22.13 skrev Justin Lebar:

> 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
> <diff>_______________________________________________
> ccache mailing list
> ccache at lists.samba.org
> https://lists.samba.org/mailman/listinfo/ccache

Anders Furuhed
Pantor Engineering AB
+46 8 412 9781



More information about the ccache mailing list