Skip to content

bpo-44331: Generate static PyCodeObjects for faster startup #26571

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

Closed
wants to merge 2 commits into from

Conversation

nascheme
Copy link
Member

@nascheme nascheme commented Jun 7, 2021

Note: this is proof of concept and not ready to be merged as is.

Usage:

  • Compile Python as normal
  • Run "make regen-freeze-startup" to re-generate Python/frozenmodules_code.c
  • Compile Python a second time

https://bugs.python.org/issue44331

pablogsal and others added 2 commits May 3, 2021 20:34
This is based on 'frozen_modules' from Jeethu Rao
<jeethu@jeethurao.com>, via Larry Hastings.  My starting point was:

    git@github.com:larryhastings/cpython.git
    not_another_use_of_the_word_frozen

Changes:

- Move static C code generation tool to Tools/freeze2
- Move _serializer to Modules
- Rebase on Python 3.10.0b1
- determine startup modules by running sys.executable
- use importlib.util.find_spec() to get code objects
- fix ref-counting when setting __path__
- put static frozen modules in frozen_code_objects dict
- reduce set of "bad" modules as it seems only _collections_abc needs
  exclusion
- fix the is_frozen_package() and is_frozen() functions to find
  static frozen code

Usage:

- Compile Python as normal
- Run "make regen-freeze-startup" to re-generate
  Python/frozenmodules_code.c
- Compile Python a second time
@github-actions
Copy link

github-actions bot commented Jul 8, 2021

This PR is stale because it has been open for 30 days with no activity.

@github-actions github-actions bot added the stale Stale PR or inactive for long period of time. label Jul 8, 2021
@brettcannon brettcannon removed their request for review July 23, 2021 17:54
@github-actions github-actions bot removed the stale Stale PR or inactive for long period of time. label Aug 9, 2022
@kumaraditya303
Copy link
Contributor

The associated issue is closed now. @nascheme Can we close it now?

@nascheme
Copy link
Member Author

The deepfreeze work supersedes this.

@nascheme nascheme closed this Sep 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants