New submission from Itamar Ostricher <itamar...@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 <rep...@bugs.python.org>
<https://bugs.python.org/issue45697>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to