{{ message }}
gh-124153: Implement PyType_GetBaseByToken() and Py_tp_token slot - #124163
Merged
Merged
Conversation
neonene
requested review from
a team,
encukou and
markshannon
as code owners
September 17, 2024 09:10
6 tasks
Contributor
Author
encukou
approved these changes
Sep 17, 2024
encukou
left a comment
Member
There was a problem hiding this comment.
Looks great, thank you!
I have just one style suggestion. But if you'd like to keep it we can merge the PR as it is.
neonene
commented
Sep 17, 2024
| return -1; | ||
| } | ||
|
|
||
| if (!_PyType_HasFeature(type, Py_TPFLAGS_HEAPTYPE)) { |
Contributor
Author
There was a problem hiding this comment.
When I observed a good performance, the line had a typo (missing a NOT), though check_base_by_token() was unused during a PGO test. The telco got slower by 5-10% once I corrected, which was actually fixed by one of the following:
-
Use
if-elsestatement -
Replace
_PyType_HasFeature()with the publicPyType_HasFeature(), not with ineffective(type->tp_flags & Py_TPFLAGS_HEAPTYPE)
They are not used in PyType_GetBaseByToken().
This chains the branches in PyType_GetBaseByToken() as well, which is effective when MSVC is in better condition on PGO.
Contributor
Author
savannahostrowski
pushed a commit
to savannahostrowski/cpython
that referenced
this pull request
Sep 22, 2024
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

PyType_GetBaseByTokenfunction withPy_tp_tokenslot #124153📚 Documentation preview 📚: https://cpython-previews--124163.org.readthedocs.build/