Skip to content

bpo-45850: Implement deep-freeze on Windows #29648

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 18 commits into from
Nov 22, 2021

Conversation

gvanrossum
Copy link
Member

@gvanrossum gvanrossum commented Nov 19, 2021

Loose ends:

  • Buildbot failures for ARM64 Windows (no Python 3.10 installed)
  • When you run make_freeze.py on Windows it makes os.path an alias of ntpath instead of posixpath (bpo-45272, bpo-45273)
  • Compilation fails on x86 (i.e., 32-bit), sigh
  • The pure-Python implementation of marshal.loads() has no tests and could be faster
  • The hack to deal with two files named codecs.c is really ugly
  • I haven't actually measured the speedup (oops)

https://bugs.python.org/issue45850

@gvanrossum gvanrossum changed the title Implement deep-freeze on Windows bpo-45850: Implement deep-freeze on Windows Nov 19, 2021
@@ -347,6 +367,18 @@
<Message Text="Updated files: @(_Updated->'%(Filename)%(Extension)',', ')"
Condition="'@(_Updated)' != ''" Importance="high" />
</Target>
<Target Name="_RebuildDeepFrozen" AfterTargets="_RebuildFrozen" Condition="$(Configuration) != 'PGUpdate'">
<Exec Command='$(PythonForBuild) "$(PySourcePath)Tools\scripts\deepfreeze.py" "%(None.OutFile)" "-m" "%(None.ModName)" -o "%(None.IntFile)"' />
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need a separate DeepIntFile?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably, yeah. It'll be used for dependency analysis, and I think it's more likely to decide that it's always out of date than to incorrectly assume it's up to date, but it's safest to only have one task creating each file during a build.

Copy link
Member

@zooba zooba left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me

@@ -347,6 +367,18 @@
<Message Text="Updated files: @(_Updated->'%(Filename)%(Extension)',', ')"
Condition="'@(_Updated)' != ''" Importance="high" />
</Target>
<Target Name="_RebuildDeepFrozen" AfterTargets="_RebuildFrozen" Condition="$(Configuration) != 'PGUpdate'">
<Exec Command='$(PythonForBuild) "$(PySourcePath)Tools\scripts\deepfreeze.py" "%(None.OutFile)" "-m" "%(None.ModName)" -o "%(None.IntFile)"' />
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably, yeah. It'll be used for dependency analysis, and I think it's more likely to decide that it's always out of date than to incorrectly assume it's up to date, but it's safest to only have one task creating each file during a build.

@gvanrossum
Copy link
Member Author

@zooba Approve all you want, but the x86 build is still broken. I'll look into that.

@gvanrossum gvanrossum marked this pull request as ready for review November 20, 2021 16:40
@gvanrossum gvanrossum requested review from tiran and a team as code owners November 20, 2021 16:40
Also use a separate intermediate file for deepfreeze.
@gvanrossum gvanrossum added the 🔨 test-with-buildbots Test PR w/ buildbots; report in status section label Nov 20, 2021
@bedevere-bot
Copy link

🤖 New build scheduled with the buildbot fleet by @gvanrossum for commit a7415ed 🤖

If you want to schedule another build, you need to add the ":hammer: test-with-buildbots" label again.

@bedevere-bot bedevere-bot removed the 🔨 test-with-buildbots Test PR w/ buildbots; report in status section label Nov 20, 2021
@gvanrossum
Copy link
Member Author

When the buildbots pass I intend to land this.

@gvanrossum
Copy link
Member Author

Speedup: amd64 with PGO, from 32 msec to 30 msec (average of 100 runs each), so about 6-7% faster. Not as much as on macOS, alas.

@niyas-sait
Copy link
Contributor

Re: Windows Arm64 failure.

I've upgraded host python to 3.10 so hopefully, that should solve the win/arm64 specific issue. Could someone retrigger the build please?

@gvanrossum
Copy link
Member Author

The ARM64 and AMD64 buildbots now pass. I'm going to ignore the failing Windows (x86) test because it's in an obscure corner of asyncio; I assume that test suite is flaky. I will land after breakfast.

@gvanrossum gvanrossum merged commit 1037ca5 into python:main Nov 22, 2021
@bedevere-bot
Copy link

@gvanrossum: Please replace # with GH- in the commit message next time. Thanks!

@gvanrossum gvanrossum deleted the windeepfreeze branch November 22, 2021 23:40
remykarem pushed a commit to remykarem/cpython that referenced this pull request Dec 7, 2021
Implement changes to build with deep-frozen modules on Windows.
Note that we now require Python 3.10 as the "bootstrap" or "host" Python.
This causes a modest startup speed (around 7%) on Windows.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants