[ccache] zlib compression patch

Lars Gustäbel lars at gustaebel.de
Wed May 12 20:21:57 GMT 2004

Hi ccache-list!

I thought I'd share a patch I made for ccache 2.3 here. This patch integrates 
zlib compression in ccache which allows it to provide more cached results 
while it consumes the same amount of disk space.

I am a Gentoo Linux user, so I have to compile every software package before 
installation, because Gentoo is a ports-based distribution. I use distcc in 
conjunction with ccache to speed up my compile-times. For me, the advantage 
of a compressed cache is, that it increases the probability of cache hits for 
compiles that do not happen quite so frequently.

The slowdown which is introduced with compression is almost negligible in 
comparison. Here are some rough figures for the compilation of a Linux Kernel 
2.6.4 with a standard config:

    plain gcc run                       729.55 sec

    first normal ccache run             747.12 sec
    second normal ccache run             92.11 sec
    cache size                            9235 k

    first patched ccache run            751.92 sec
    second patched ccache run            92.68 sec
    cache size                            5491 k

More details:

    - configure takes --enable-zlib and --disable-zlib options, whereas
      zlib support is on by default.
    - A new environment variable CCACHE_NOCOMPRESS is introduced by
      which the user is able to turn off zlib compression.


    - The compressed cache is incompatible with common ccache
      versions. So, shared caches need extra care.
    - CCACHE_HARDLINK has no effect for compressed files in the

You can download the patch here:

I hope, you can make use of it.

Lars Gustäbel
lars at gustaebel.de

The trouble with the world is that the stupid are cocksure
and the intelligent full of doubt.
(Bertrand Russell)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: signature
Url : http://lists.samba.org/archive/ccache/attachments/20040512/e4b6d49c/attachment.bin

More information about the ccache mailing list