Skip to content

bpo-40151 reduce _overlapped size - #19298

Closed
ariccio wants to merge 2 commits into
python:masterfrom
ariccio:investigate-overlapped-size
Closed

ariccio wants to merge 2 commits into
python:masterfrom
ariccio:investigate-overlapped-size

Conversation

@ariccio

@ariccio ariccio commented Apr 2, 2020 •

Copy link
Copy Markdown
Contributor

Similarly to bpo-40145, this tweaks build options to reduce the size of the
binary.

This patch turns on (for release builds) Whole Program Optimization, MinSpace
optimization, /Ob2 AnySuitable function inlining, /Zo (so that people can still
debug it when lots of code has been optimized out), /OPT:REF dead code
elimination, /OPT:ICF COMDAT folding, Link Time Code Generation, and DebugFull
debugging information creation.

For debug builds, it enables all of that, except instead of the MinSpace
optimization, it's only /Ob2 with custom optimization. My intent is to not
optimize any asserts or similar checks, while still getting the benefit of
dead and duplicate code elimination.

_overlapped.pyd   32 bit unimproved release size: 31KB
_overlapped.pyd   32 bit   improved release size: 29KB
                                size reduction:   -3KB
                             %  size reduction:    10%

_overlapped_d.pyd 32 bit unimproved release size: 55KB
_overlapped_d.pyd 32 bit   improved release size: 34KB
                                size reduction:  -21KB
                             %  size reduction:    38%




_overlapped.pyd   64 bit unimproved release size: 39KB
_overlapped.pyd   64 bit   improved release size: 36KB
                                size reduction:   -3KB
                             %  size reduction:     8%


_overlapped_d.pyd 64 bit unimproved release size: 74KB
_overlapped_d.pyd 64 bit   improved release size: 41KB
                                size reduction:  -33KB
                             %  size reduction:    45%

https://bugs.python.org/issue40151

ariccio added 2 commits April 1, 2020 23:47
Similarly to bpo-40145, this tweaks build options to reduce the size of the
binary.

_overlapped.pyd   32 bit unimproved release size: 31KB
_overlapped.pyd   32 bit   improved release size: 29KB
                                size reduction:   -3KB
                             %  size reduction:    10%

_overlapped_d.pyd 32 bit unimproved release size: 55KB
_overlapped_d.pyd 32 bit   improved release size: 34KB
                                size reduction:  -21KB
                             %  size reduction:    38%

_overlapped.pyd   64 bit unimproved release size: 39KB
_overlapped.pyd   64 bit   improved release size: 36KB
                                size reduction:   -3KB
                             %  size reduction:     8%

_overlapped_d.pyd 64 bit unimproved release size: 74KB
_overlapped_d.pyd 64 bit   improved release size: 41KB
                                size reduction:  -33KB
                             %  size reduction:    45%
@taleinat

Copy link
Copy Markdown
Contributor

Ping, @python/windows-team?

@ariccio

ariccio commented Sep 26, 2020

Copy link
Copy Markdown
Contributor Author

Sorry, I need to reland this whole series. The pandemic and family got in the way, and I need to redo the build options pull.

@ariccio ariccio closed this Sep 26, 2020
@taleinat

Copy link
Copy Markdown
Contributor

Sorry, I need to reland this whole series. The pandemic and family got in the way, and I need to redo the build options pull.

No worries, thanks for working on this!

Be safe.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants