-
-
Notifications
You must be signed in to change notification settings - Fork 31.9k
Add internal API for fast module access from heap type methods #101476
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
Labels
extension-modules
C modules in the Modules dir
performance
Performance or resource usage
topic-C-API
type-feature
A feature request or enhancement
Comments
erlend-aasland
added a commit
to erlend-aasland/cpython
that referenced
this issue
Jan 31, 2023
For fast module state access from heap type methods.
relevant discuss thread: https://discuss.python.org/t/a-fast-variant-of-pytype-getmodulestate/23377 i left a question on the PR regarding the API name (ALL_CAPS or not for in the API name to be similar to other fast unchecked APIs). |
miss-islington
pushed a commit
that referenced
this issue
Feb 23, 2023
For fast module state access from heap type methods.
erlend-aasland
added a commit
to erlend-aasland/cpython
that referenced
this issue
Feb 23, 2023
erlend-aasland
added a commit
that referenced
this issue
Feb 24, 2023
JelleZijlstra
pushed a commit
to JelleZijlstra/cpython
that referenced
this issue
Sep 10, 2024
For fast module state access from heap type methods.
JelleZijlstra
pushed a commit
to JelleZijlstra/cpython
that referenced
this issue
Sep 10, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
extension-modules
C modules in the Modules dir
performance
Performance or resource usage
topic-C-API
type-feature
A feature request or enhancement
See topic on Discourse.
For CPython internal usage, we've got
_PyModule_GetState
, which is a fast variant ofPyModule_GetState
, the module check in the latter is simply an assert in the former.For
PyType_GetModuleState
, there are threeif
s (two of them implicitly inPyType_GetModule
):PyType_GetModule
is notNULL
For stdlib core extension modules, all of these conditions are always true (AFAIK). With a fast static inlined variant, for example
_PyType_GetModuleState
, with a fast variant ofPyType_GetModule
inlined, where all three conditions areassert()
ed, we can speed up a heap type methods that need to access module state.Linked PRs
The text was updated successfully, but these errors were encountered: