This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Title: _overlapped room for improvement
Type: enhancement Stage: patch review
Components: Windows Versions: Python 3.9
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: Alexander Riccio, paul.moore, steve.dower, tim.golden, zach.ware
Priority: normal Keywords: patch

Created on 2020-04-02 03:46 by Alexander Riccio, last changed 2022-04-11 14:59 by admin.

Pull Requests
URL Status Linked Edit
PR 19298 closed Alexander Riccio, 2020-04-02 03:55
Messages (2)
msg365567 - (view) Author: Alexander Riccio (Alexander Riccio) * Date: 2020-04-02 03:46
Similarly to bpo-40145, I've tweaked build options to reduce the size of the

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%

If this patch is merged, and all 7 million (estimated) Python developers update their installation, I calculate that I just saved the PSF 21GB worth of bandwidth costs :)
msg365605 - (view) Author: Steve Dower (steve.dower) * (Python committer) Date: 2020-04-02 16:39
While you're working on these, the most important comparison to make is against the binaries from our 64-bit release. We've run PGO on those, and from the stats shown it optimises almost everything for size already. (You can enable the same profile by running "build.bat --pgo".)

For debug builds, I would prefer to optimise for (re)compile time. We can accept larger binaries in that case.
Date User Action Args
2022-04-11 14:59:28adminsetgithub: 84332
2020-04-02 16:39:03steve.dowersetmessages: + msg365605
2020-04-02 03:55:50Alexander Ricciosetkeywords: + patch
stage: patch review
pull_requests: + pull_request18658
2020-04-02 03:46:48Alexander Ricciocreate