ccache-zlib
Facts and Figures  •  Download  •  Gentoo Linux  •  Acknowledgements  •  License
home

Android Apps
 Quisine
 
Python programs
 can
 Krikkit
 usEd
 
Python modules
 configparse
 tarfile
 
Source Patches
 ccache-zlib
 
Tools
 g33x-toolbox
 
Feeds
 RSS 2.0

A patch for ccache that lets it use zlib compression for the cache.

Facts and Figures

ccache is a compiler cache. It acts as a caching pre-processor to C/C++ compilers, using the -E compiler switch and a hash to detect when a compilation can be satisfied from cache. This often results in a 5 to 10 times speedup in common compilations.

This patch adds zlib compression support to ccache which effectively increases the capacity of the cache. The overhead which is introduced by compression is negligible in comparison to ccache's usual slowdown. For those who like figures, here are some rough statistics for the compilation of a vanilla 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

Some details:

  • configure takes --enable-zlib and --disable-zlib options, whereas zlib support is enabled by default.
  • a new environment variable CCACHE_NOCOMPRESS is introduced by which the user is able to turn off zlib compression.
  • old cached results are still usable.
  • included is a bash script manage-cache.sh that can be used to de/compress the entire cache.

Downsides:

  • the compressed cache is unusable for common ccache versions.
  • CCACHE_HARDLINK has no effect on compressed files in the cache.

Download

The current patch for ccache-2.4:

How to build it:

$ tar xvzf ccache-2.4.tar.gz
$ cd ccache-2.4
$ bzcat ../ccache-compressed-cache-2.4.diff.bz2 | patch
$ ./configure && make

Gentoo Linux

For all those Gentoo users (like myself) I've created an ebuild file. Put it in $PORTDIR_OVERLAY/dev-util/ccache and type "emerge ccache".

Acknowledgements

Many thanks to:

  • Peter Kovar who contributed a small bugfix.

License

ccache-zlib is distributed under the GNU GPL license.

ccache-zlib - Copyright © 2004, Lars Gustäbel (lars@gustaebel.de)
All rights reserved.

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA

powered by django