New submission from Alexander Riccio <test35...@gmail.com>:
I've tweaked the pcbuild options for pyshellext to reduce the size of the binary. Since this is a very simple component, there really isn't much benefit of optimizing for speed, likely the slowest part of this component's lifetime is simply loading it. This patch turns on Whole Program Optimization, MinSpace optimization, /Ob2 AnySuitable function inlining (to expose more code to elimination, this does actually help here), /Zo (so that people can still debug it when lots of code has been optimized out), turns of C++ RTTI (nobody is using it), /OPT:REF dead code elimination, /OPT:ICF COMDAT folding, Link Time Code Generation, and DebugFull debugging information creation. /Gw global data optimization seemed to do nothing, which makes sense since there isn't much going on in this project, very little in the way of actual global data. Disabling C++ exceptions both in the project config (i.e. /EH-), and disabling stdlib exceptions via _HAS_EXCEPTIONS=0, had no effect. Strangely, with exceptions disabled and _HAS_EXCEPTIONS=0, exception functions are still emitted in the binary (as seen in IDA). I presume it has something to do with the fact that its a dll. Enabling optimizations (even for Debug builds) should have no effect. The debug builds were not actually using debugging featuers (not even assert), so nothing should change. pyshellext.dll 32 bit unimproved release size: 42KB pyshellext.dll 32 bit improved release size: 25KB size reduction: -17KB % size reduction: 40% pyshellext_d.dll 32 bit unimproved debug size: 85KB pyshellext_d.dll 32 bit improved debug size: 32KB size reduction: -53KB % size reduction: 62% pyshellext.dll 64 bit unimproved release size: 52KB pyshellext.dll 64 bit improved release size: 30KB size reduction: -22KB % size reduction: 42% pyshellext_d.dll 64 bit unimproved debug size: 105KB pyshellext_d.dll 64 bit improved debug size: 38KB size reduction: -67KB % size reduction: 63% ---------- components: Windows messages: 365527 nosy: Alexander Riccio, paul.moore, steve.dower, tim.golden, zach.ware priority: normal severity: normal status: open title: Pyshellext room for binary size improvement versions: Python 3.9 _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue40145> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com