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
Initially I just planned to get rid of PyLong_AS_LONG (undocumented transitional alias of PyLong_AsLong) in Objects/unicodeobject.c. But I have used opportunity to add few optimizations in the nearby code. I do not expect significant performance boost, but some overhead was removed in specific corner cases:
PyLong_AsLongAndOverflow is now only called once for the replacement code (PyLong_AS_LONG was called twice).
Using PyMapping_GetOptionalItem instead of PyObject_GetItem allows to avoid raising a KeyError if the translation table is a dict. I left this case in previous round (Add PyMapping_GetOptionalItem() #106307) because this does not make the code simpler (we still need to handle other LookupError), but it still has a tiny performance benefit.
… codec
* Replace PyLong_AS_LONG() with PyLong_AsLong().
* Call PyLong_AsLong() only once per the replacement code.
* Use PyMapping_GetOptionalItem() instead of PyObject_GetItem().
…GH-122932)
* Replace PyLong_AS_LONG() with PyLong_AsLong().
* Call PyLong_AsLong() only once per the replacement code.
* Use PyMapping_GetOptionalItem() instead of PyObject_GetItem().
Uh oh!
There was an error while loading. Please reload this page.
Initially I just planned to get rid of
PyLong_AS_LONG
(undocumented transitional alias ofPyLong_AsLong
) inObjects/unicodeobject.c
. But I have used opportunity to add few optimizations in the nearby code. I do not expect significant performance boost, but some overhead was removed in specific corner cases:PyLong_AsLongAndOverflow
is now only called once for the replacement code (PyLong_AS_LONG
was called twice).PyMapping_GetOptionalItem
instead ofPyObject_GetItem
allows to avoid raising aKeyError
if the translation table is adict
. I left this case in previous round (Add PyMapping_GetOptionalItem() #106307) because this does not make the code simpler (we still need to handle otherLookupError
), but it still has a tiny performance benefit.Linked PRs
The text was updated successfully, but these errors were encountered: