[issue45697] PyType_IsSubtype is doing excessive work in the common case
Itamar Ostricher
report at bugs.python.org
Tue Nov 2 21:12:41 EDT 2021
New submission from Itamar Ostricher <itamarost at gmail.com>:
Based on real world profiling data we collected, a vast amount of `PyType_IsSubtype` calls are coming from `type_call`, when it decides whether `__init__` should run or not.
In the common case, the arguments to this call are identical, but the implementation still walks the MRO.
By returning early for identical types, the common case can be optimized with a non-trivial performance gain.
----------
components: Interpreter Core
messages: 405575
nosy: itamaro
priority: normal
severity: normal
status: open
title: PyType_IsSubtype is doing excessive work in the common case
type: performance
versions: Python 3.11
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue45697>
_______________________________________
More information about the Python-bugs-list
mailing list