-
-
Notifications
You must be signed in to change notification settings - Fork 30.5k
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
Simplify PyStackRef_FromPyObjectSteal
#127022
Labels
performance
Performance or resource usage
topic-free-threading
type-feature
A feature request or enhancement
Comments
colesbury
added
type-feature
A feature request or enhancement
performance
Performance or resource usage
topic-free-threading
labels
Nov 19, 2024
colesbury
added a commit
to colesbury/cpython
that referenced
this issue
Nov 19, 2024
This gets rid of the immortal check in `PyStackRef_FromPyObjectSteal()`. Overall, this improves performance about 2% in the free threading build. This also renames `PyStackRef_Is()` to `PyStackRef_IsExactly()` because the macro requires that the tag bits of the arguments match, which is only true in certain special cases.
colesbury
added a commit
to colesbury/cpython
that referenced
this issue
Nov 19, 2024
This gets rid of the immortal check in `PyStackRef_FromPyObjectSteal()`. Overall, this improves performance about 2% in the free threading build. This also renames `PyStackRef_Is()` to `PyStackRef_IsExactly()` because the macro requires that the tag bits of the arguments match, which is only true in certain special cases.
I think this will also allow us to simplify or remove |
colesbury
added a commit
that referenced
this issue
Nov 22, 2024
This gets rid of the immortal check in `PyStackRef_FromPyObjectSteal()`. Overall, this improves performance about 2% in the free threading build. This also renames `PyStackRef_Is()` to `PyStackRef_IsExactly()` because the macro requires that the tag bits of the arguments match, which is only true in certain special cases.
colesbury
added a commit
to colesbury/cpython
that referenced
this issue
Nov 22, 2024
The interpreter now handles `_PyStackRef`s pointing to immortal objects without the deferred bit set, so `_PyEvalFramePushAndInit_UnTagged` is no longer necessary.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
performance
Performance or resource usage
topic-free-threading
type-feature
A feature request or enhancement
Feature or enhancement
Currently,
PyStackRef_FromPyObjectSteal
checks if the object is immortal in order to set thePy_TAG_DEFERRED
bit.cpython/Include/internal/pycore_stackref.h
Lines 96 to 105 in 29cbcbd
This check isn't necessary and has a performance cost that's not made up for by the slightly faster
PyStackRef_CLOSE()
calls orPyStackRef_Is()
checks.We should simplify
PyStackRef_FromPyObjectSteal
so that it creates_PyStackRef
directly from thePyObject *
without setting any tag bits.Linked PRs
PyStackRef_FromPyObjectSteal
#127024_PyEvalFramePushAndInit_UnTagged
#127168The text was updated successfully, but these errors were encountered: