SethMMorton / fastnumbers

Super-fast and clean conversions to numbers for Python.
https://pypi.org/project/fastnumbers/
MIT License
105 stars 13 forks source link

Please strip the shared library #20

Closed yurivict closed 6 years ago

yurivict commented 6 years ago
$ file ./work-py27/stage/usr/local/lib/python2.7/site-packages/fastnumbers.so
./work-py27/stage/usr/local/lib/python2.7/site-packages/fastnumbers.so: ELF 64-bit LSB shared object, x86-64, version 1 (FreeBSD), dynamically linked, not stripped

The FreeBSD port always strips it with a separate instruction. It would be better if it would be stripped during build.

Thank you.

SethMMorton commented 6 years ago

Please explain what stripping means, what are the benefits, and how I can go about doing it within the context of setuptools.

SethMMorton commented 6 years ago

In the link below, Donald Stufft (the lead maintainer of PyPA and pip) states that they chose not to strip binaries installed with pip because it is not universally safe.

https://github.com/pypa/pip/issues/3938#issuecomment-290487531

For the sake of argument, let us ignore that for a moment. Let us suppose that I decide to put in the work to a) figure out all the compiler flags for all the various supported compilers and all versions of those compilers to strip at build time, and then b) get it to work in CI (and hope that correlates to working on people's machines as well), will you be willing to field all issues created due to stripping the extra symbols, including when people try to run the code through a debugger and finding they cannot because debugging symbols were stripped from the binary?

yurivict commented 6 years ago

Stripping means removing ELF sections that aren't needed for it to run.

It is accomplished by running the 'strip' command: https://linux.die.net/man/1/strip

The benefits are - reduced size of installed packages on disk. Marginally faster runtimes, because file sizes are smaller, no need to go through or skip unneeded sections.

yurivict commented 6 years ago

Many python projects don't strip. Maybe this is just not easy in python, I'm not sure. But most GNU make-based projects, and cmake-based projects do strip.

yurivict commented 6 years ago

Closing this, because this doesn't appear to be easy to fix for individual projects.