You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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