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.)
Note that this only covers the current members of _PyRuntimeState, PyInterpreterState, and PyThreadState. Current static globals will be dealt with separately.
This sounds like an Epic, right? Many of the subtasks are worthy of being separate PRs and hence separate issues, according to our new approach to the Project board.
The changes so far have had almost zero impact on performance. So I'm probably going to table this overall effort. (It's worth doing for other reasons, but not for improving performance.) However, there may be a few specific parts that are worth doing. I'll create separate tasks for any of those.
(See #177.)
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.)Structure
TODO
Note that this only covers the current members of
_PyRuntimeState
,PyInterpreterState
, andPyThreadState
. Current static globals will be dealt with separately._Py_bytes_state
into_PyRuntimeState.global_objects.singletons
#180_Py_unicode_state.empty_string
and_Py_unicode_state.latin1
into_PyRuntimeState.global_objects.singletons
_Py_unicode_state.ids
(_Py_Identifier
) into_PyRuntimeState.global_objects.singletons
#198_Py_exc_state.errnomap
and_Py_exc_state.PyExc_ExceptionGroup
into_PyRuntimeState.global_objects.singletons
_Py_ast_state
into_PyRuntimeState.global_objects.singletons
_Py_exc_state.memerrors_freelist
to_PyRuntimeState.global_objects.freelists.memory_errors
PyInterpreterState.float_state to
PyInterpreterState.global_objects.freelists.float`PyInterpreterState.tuple_state to
PyInterpreterState.global_objects.freelists.tuple`PyInterpreterState.list_state to
PyInterpreterState.global_objects.freelists.list`PyInterpreterState.dict_state to
PyInterpreterState.global_objects.freelists.dict`PyInterpreterState.async_gen_state to
PyInterpreterState.global_objects.freelists.async_gen`PyInterpreterState.context_state to
PyInterpreterState.global_objects.freelists.context`PyInterpreterState.slice_cache to
PyInterpreterState.global_objects.freelists`PyInterpreterState.type_cache to
_PyRuntimeState.global_objects.caches.type_attrs`_Py_unicode_state.interned
intoPyInterpreterState.global_objects.caches
_PyRuntimeState.interpreters.main
PyThreadState
_PyRuntimeState.global_objects
and helpers_PyRuntimeState.global_objects.singletons
and helpers_PyRuntimeState.global_objects.freelists
and helpers_PyRuntimeState.global_objects.caches
and helpersPyInterpreterState.modules
(dict)PyInterpreterState.modules_by_index
(list)PyInterpreterState.sysdict
(dict)PyInterpreterState.builtins
(dict)PyInterpreterState.importlib
(dict)PyInterpreterState.codec_search_path
(list)PyInterpreterState.codec_search_cache
(dict)PyInterpreterState.codec_error_registry
(dict)PyInterpreterState.dict
(dict)PyInterpreterState.warnings.filters
(list)PyInterpreterState.warnings.once_registry
(dict)PyInterpreterState.gc.trash_delete_later
(list)PyInterpreterState.gc.garbage
(list)PyInterpreterState.gc.callbacks
(list)PyInterpreterState.audit_hooks
(list)PyThreadState.dict
(dict)PyThreadState.trash_delete_later
(list)The text was updated successfully, but these errors were encountered: