[issue31336] Speed up _PyType_Lookup() for class creation

Stefan Behnel report at bugs.python.org
Mon Sep 4 09:00:24 EDT 2017


Stefan Behnel added the comment:

It's the slot names in "slotdefs". See "update_one_slot()".

The time that is saved is mostly the overhead of calling PyDict_GetItem(). I actually tried PyDict_GetItemWithError() first, which is faster due to the lower error handling overhead, before I noticed that the real problem is the repeated lookups of the same name, which can be optimised further by pre-calculating the hash and calling the low-level lookup function.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue31336>
_______________________________________


More information about the Python-bugs-list mailing list