Skip to content

bpo-45020: Freeze the modules imported during startup.#28107

Closed
ericsnowcurrently wants to merge 61 commits intopython:mainfrom
ericsnowcurrently:frozen-startup-modules
Closed

bpo-45020: Freeze the modules imported during startup.#28107
ericsnowcurrently wants to merge 61 commits intopython:mainfrom
ericsnowcurrently:frozen-startup-modules

Conversation

@ericsnowcurrently
Copy link
Member

@ericsnowcurrently ericsnowcurrently commented Aug 31, 2021

[I'm going to split this PR up.]

Doing this provides some significant performance gains for runtime startup. This change also adds a command-line flag (-X frozen_modules=[on|off]) that allows users to opt out of (or into) using frozen modules. When run in a development environment it defaults to opting out, to avoid contributors wasting time trying to figure out why their changes aren't getting used.

Note that I plan on updating the tests for the frozen modules so they run against the frozen and unfrozen modules, like we do with importlib. We'll also be looking at making frozen modules more like source modules in a separate PR.

There are only a handful of things left to do here before this could be merged:

  • get the "check_generated_files" job passing
  • deal with frozen modules on the WIndows builds
  • sort out PyConfig.stdlib_dir on Windows
  • ensure default "-X frozen_modules=on" for PGO builds
  • problem in test_4_daemon_threads in test_threading (timing out with "-X frozen_modules=on")
  • drop Python/frozen_modules/MANIFEST?

https://bugs.python.org/issue45020

Loading
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.

5 participants