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
Performance of PyObject_HasAttrString #104078
Comments
What are the before and after timings? Have you tested the impact on something other than a micro benchmark? |
There appear to be no calls to |
the before and after numbers are quoted in the PR description (the optimization is about 3.3X speedup).
as @JelleZijlstra pointed out, this doesn't really show up within cpython itself. it showed up in Instagram profiling data due to internal and/or third-party usage (I don't have the data available to pinpoint it). |
Feature or enhancement
PyObject_HasAttrString
is implemented in terms ofPyObject_GetAttrString
/PyErr_Clear
.for non-existing attributes, there's significant overhead from creating an error only to clear it later.
this can be optimized by implementing it in terms of
PyObject_HasAttr
.microbenchmark
Linked PRs
The text was updated successfully, but these errors were encountered: