Reduce size of wheels by stripping debug information#108
Reduce size of wheels by stripping debug information#108rhpvorderman merged 1 commit intodevelopfrom
Conversation
Codecov Report
@@ Coverage Diff @@
## develop #108 +/- ##
========================================
Coverage 95.18% 95.18%
========================================
Files 2 2
Lines 249 249
Branches 65 65
========================================
Hits 237 237
Misses 5 5
Partials 7 7 Continue to review full report at Codecov.
|
|
@marcelm This is very important when building containers. Having unhelpful information in the binaries bloats the binary. I expect exactly nobody who is installed python-isal to run gdb on it, so I checked and it seems that CFLAGS does not override any options when building, but merely adds the flags to the compile command. That is a good thing, that limits any unforeseen side effects. I did some size comparisions: With Better! No let's run strip on it That's quite a difference! Note how for the very very simple I will do some investigating before I merge this. There is no haste as I am waiting for the next release of ISA-L to release 1.0.0. |
|
(It’s mentioned in the linked issue:) It appears that |
|
My bad! I still had the build cache on for python-isal (that way it only builds ISA-L once). The build options are passed trough to ISA-L. So I rebuild ISA-L as well now with -g0: Much better! Strip looks even better though, but I do need a better understanding of this before I dare to apply it. For now |
|
An excellent addition, thanks @marcelm ! |
|
Great! Then the savings are similar to what I see in Cutadapt and dnaio. |
|
For posteriety this does not work well with the windows build of ISA-L. So the flag was removed for Windows. |
|
I also checked As for strip, it removes the complete symbol table and relocation information. I have no idea what the impact of that is. I do know that numpy is content with just stripping of the debug information so I will keep it at that too. Thanks again! |
According to marcelm/dnaio#47, it seems you like smaller wheels, so I’d like to suggest using
CFLAGS=-g0to reduce their size.See pypa/cibuildwheel#331
I’m using this option already in dnaio and Cutadapt and it works well (wheel size is now ~150 kB instead of ~500 kB). I wasn’t able to test this locally for python-isal, so the savings may be smaller, but running
strip(which I assume does something similar as-g0would do) on the uncompressed.sofiles on the wheels available from PyPI reduces their size by 90%.It is possible that the option is not necessary or has no effect on Windows and/or macOS; I just added it for completeness.
Checklist