Title: Build libraries with "/OPT:REF" linker optimization on Windows
Type: performance Stage: patch review
Components: Windows Versions: Python 3.10
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: Austin-Lamb, eryksun, paul.moore, steve.dower, terry.reedy, tim.golden, zach.ware
Priority: normal Keywords: patch

Created on 2021-01-04 17:42 by Austin-Lamb, last changed 2021-01-08 23:27 by terry.reedy.

Pull Requests
URL Status Linked Edit
PR 24098 open Austin-Lamb, 2021-01-04 17:59
Messages (2)
msg384333 - (view) Author: Austin Lamb (Austin-Lamb) * Date: 2021-01-04 17:42
I noticed that CPython and the various libraries built out of the repo aren't using the "/OPT:REF" linker optimization on Windows.  This optimization allows the linker to throw away dead/unreachable code, resulting in a substantial decrease in binary size.  That in turn also reduces the amount of Disk I/O that must be done to get these binaries in memory (which can be meaningful on spinning hard drives that are still rather common), and the reference set of applications using Python.

I'll send a PR for this shortly, just filing the issue to be able to reference it in the PR.
msg384695 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2021-01-08 23:27
The PR says that this deletes "uncalled code".  I imagine that this is safe for a .exe.  But for a .dll?  As i understand it, one can, from python code, access any function via ctypes, so it seems to me that there is no way for the linker to know which callable functions in a .dll can be safely deleted.  Am I missing something?
Date User Action Args
2021-01-08 23:27:30terry.reedysetnosy: + terry.reedy
messages: + msg384695
2021-01-06 06:29:26ammar2setnosy: + eryksun

title: Optimization opportunity on Windows -> Build libraries with "/OPT:REF" linker optimization on Windows
2021-01-04 17:59:34Austin-Lambsetkeywords: + patch
stage: patch review
pull_requests: + pull_request22928
2021-01-04 17:42:40Austin-Lambcreate