On the size of CHICKEN binaries

Posted on May 8, 2019

I have noticed previously that the size of binary programs and shared libraries produced by the CHICKEN compiler seemed big to me. I was partly right, but in the end wrong. Let’s look at the mmck-pfds package, on my Slackware ‘x86_64-pc-linux-gnu’, after a fresh checkout from the repository:

$ sh autogen.sh
$ ./configure --enable-maintainer-mode
$ make -j3 all
$ stat --printf='%s\n' lib/mmck.pfds.so
879520
$ strip -s lib/mmck.pfds.so
$ stat --printf='%s\n' lib/mmck.pfds.so
805384

this is the result with the default CHICKEN compiler options: the package selects only the options needed to compile a shared library and to find source code and dependency libraries.

Let’s try it again with some optimisation turned on:

$ make clean
$ make -j3 all CHICKEN_FLAGS=-O4
$ stat --printf='%s\n' lib/mmck.pfds.so
574688
$ strip -s lib/mmck.pfds.so
$ stat --printf='%s\n' lib/mmck.pfds.so
524648

still big? Mh, but there is quite a difference!

Now I would like to go CHICKEN’s home site and read a tutorial on how the optimisation levels are meant to be used: which one is better while developing, which one is better for end user installation? Better for speed? Better for size? Which options are meaningful for the underlying C language compiler (given the particular C code CHICKEN generates)? Unfortunately if there is such a thing, I was not able to find it… If I search the site for “compiler optimization levels” or “compiler optimization tutorial”, I get no results.