Closed
Description
The full runtime state of a cpython process is found in PyRuntimeState
, PyInterpreterState, and
PyThreadState(and, for now, a bunch of static variables), which currently form a single tree at runtime under the
_PyRuntime` global variable. Currently these three structs hold many pointers, which are (allocated and) populated during runtime initialization.
For most of the pointers we could instead replace them with static declarations (of the the corresponding data) in the relevant Py*State
structs. (This wouldn't work for any variables where the size isn't fixed at compile time (e.g. PyVarObject
) but it should work for most.)
Benefits
- fewer allocations during initialization
- greater cache locality
- some simplification in the runtime code
- more runtime state can move into the DATA section of the executable
- makes Freeze initialized runtime state for use in subsequent executions. #78 easier
- helps make creating subinterpreters faster (memcpy + fixups)
Metadata
Metadata
Assignees
Labels
No labels