[Python-Dev] Minipython

Giovanni Bajo rasky at develer.com
Sun Sep 24 01:16:54 CEST 2006


Milan Krcmar wrote:

> Current (2.5) stripped and gzipped (I am going to use a compressed
> filesystem) CPython binary, compiled with defaults on a i386/glibc
> Linux, results in 500 KiB of "flash". How to make the Python
> interpreter even smaller?

In my experience, the biggest gain can be obtained by dropping the rarely-used
CJK codecs (for Asian languages). That should sum up to almost 800K
(uncompressed), IIRC. After that, I once had to strip down the binary even
more, and found out (by guesswork and inspection of map files) that there is no
other low hanging fruit. By carefully selecting which modules to link in, I was
able to reduce of another 300K or so, but nothing really incredible. I would
also suggest -ffunction-sections in these cases, but you might already know
that.

Giovanni Bajo



More information about the Python-Dev mailing list