[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

performance tip for the package development stage



Hi all,

I'm sorry if this is well known. I haven't seen it anywhere, and I thought I'd share it with everybody.

During the initial package development stage, there is a lot of repeated compilation of the same package over and over again. With some packages that's not so bad, but some take a long time to compile. I'd like to draw people's attention to a small program that can greatly help. It's called ccache, and this is the effect it has on my system.

When compiling a package called "xparam" for the first time, these are the timing results (dpkg-buildpackage, including clean)
real    9m44.129s
user    7m48.328s
sys     1m5.499s

The second time around, these are the results:
real    1m50.366s
user    0m58.678s
sys     0m27.084s

It works by caching the output (both stdout/stderr, and the file output) of the compiler, and performing md5 on the input. If the same input is given, it will produce the same output.

In order to set it up, apt-get install ccache. Then create a directory somewhere and put there symlinks from cc, gcc, c++ and g++ to /usr/bin/ccache. When you want to make use of this feature, add this directory to the beginning of your path and work as you would always work.

Personally, I wouldn't use this for compiling the package after you have done with the debian related development, but the ccache author claims it's totally safe for that as well.

I hope people find this tip useful.

         Shachar

--
Shachar Shemesh
Lingnu Open Source Consulting ltd.
Have you backed up today's work? http://www.lingnu.com/backup.html



Reply to: