You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In many places we still use PyObject_GetAttrString or PyObject_GetAttr. It would be good to:
Ensure we use PyObject_GetAttr with an interned string wherever the lookup may be in a performance relevant code branch. Exceptions are for example:
Anything that happens only once, e.g. import time.
It may not be worth making e.g. error paths more complicated just to use this.
Use PyObject_GetOptionalAttr whenever a possible AttributeError is ignored (or all exceptoins, although it's best not to ignore all exceptions).
Creating the unicode objects isn't that fast, I think. And PyObject_GetOptionalAttr can be massively faster if the attribute isn't found because it can avoid the error creation.
The text was updated successfully, but these errors were encountered:
In many places we still use
PyObject_GetAttrString
orPyObject_GetAttr
. It would be good to:PyObject_GetAttr
with an interned string wherever the lookup may be in a performance relevant code branch. Exceptions are for example:PyObject_GetOptionalAttr
whenever a possibleAttributeError
is ignored (or all exceptoins, although it's best not to ignore all exceptions).Creating the unicode objects isn't that fast, I think. And
PyObject_GetOptionalAttr
can be massively faster if the attribute isn't found because it can avoid the error creation.The text was updated successfully, but these errors were encountered: