Skip to content

Freeze/link all stdlib modules imported during startup. #82

@ericsnowcurrently

Description

@ericsnowcurrently

During runtime startup we import a bunch of modules, particularly if the site module is used (without -S). Any of these that aren't frozen/linked incur a substantial IO overhead. We already freeze importlib and link a number of builtin modules. The idea here is that we freeze/link the rest.

To do:

after:

investigate:

  • create a flamegraph for "after"
  • figure out where all the unexpected syscalls are coming from (e.g. 25 stats, down from 80)
  • get a clear picture of where the other syscalls come from (e.g. "rt_sigaction", "mmap")

related:


Candidate solutions to the editing-stdlib-.py-files problem, from bpo-45020:

  • use a command-line flag to opt-out of frozen modules?
  • use a build flag to opt out (e.g. a configure flag or a new Py_NO_FROZEN or even Py_DEBUG)?
  • ignore frozen modules if it's a dev build?
  • (note: importlib._bootstrap and importlib._bootstrap_external must always be frozen, regardless of a flag)
  • accommodate users of an installed Python that sometimes edit stdlib modules while debugging code?
  • always emit a warning if a frozen module is ignored (in favor of the source module)?

Metadata

Metadata

Type

No type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions