Shrinking Python
Neal Norwitz
neal at metaslash.com
Thu Jun 13 22:36:25 EDT 2002
On Thu, 13 Jun 2002 16:15:39 -0400, Mahrt, Dallas wrote:
> I am looking into using Python in a small device with limited space for
> binaries. Due to this, I am both investigating creating a shared library
> with the interpreter and shrinking the footprint of this library. I have
> found many threads talking bout shared libraries, so I am not too
> concerned about that aspect.
>
> I am concerned about shrinking the library's binary footprint. I did
> find several links to a "Deeply Embedded Python" based on 1.5.1 which
> has since vanished. I have stripped the library to improve size some (to
> ~1.13 MB) but would like to reduce it further. Has anyone tackled this
> or even attempted? Are there any links to resources that may help me
> that I haven't found?
How small do you want it to go? My stripped sizes on Linux are:
-rw-r--r-- 1 neal cvs 702902 Jun 13 22:10 libpython2.3.a
-rwxr-xr-x 1 neal cvs 682428 Jun 13 22:13 python*
This is with the latest CVS version and passing --without-doc-strings
to ./configure. You should be able to easily drop the library
down by 90k, by removing: unicode, regular expressions, and posix.
Without too much work, ie. by defining -DWITHOUT_COMPLEX, and
./configure --without-doc-strings --without-unicode \
--without-signal-module --disable-shared
I get this:
[neal at epoch src]$ ls -l libpython2.3.a python
-rw-r--r-- 1 neal cvs 686126 Jun 13 22:29 libpython2.3.a
-rwxr-xr-x 1 neal cvs 664828 Jun 13 22:29 python*
Neal
More information about the Python-list
mailing list