Skip to content
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

bpo-45697: PyType_IsSubtype: Return early for identical type objects #29380

Closed

Conversation

itamaro
Copy link
Contributor

@itamaro itamaro commented Nov 3, 2021

bpo-45697: PyType_IsSubtype: Return early for identical type objects

Based on real world profiling data we collected, a vast amount of PyType_IsSubtype calls are coming from type_call, when it decides whether __init__ should run or not.

In the common case, the arguments to this call are identical, but the implementation still walks the MRO.

By returning early for identical types, the common case can be optimized with a non-trivial performance gain.

https://bugs.python.org/issue45697

@itamaro
Copy link
Contributor Author

itamaro commented Nov 3, 2021

superseded by GH-29392

@itamaro itamaro closed this Nov 3, 2021
@itamaro itamaro deleted the bpo-45697-is-subtype-optimization branch March 22, 2023 16:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants