[issue34396] Certain methods that heap allocated subtypes inherit suffer a 50-80% performance penalty
Raymond Hettinger
report at bugs.python.org
Fri Jul 19 13:00:35 EDT 2019
Raymond Hettinger <raymond.hettinger at gmail.com> added the comment:
Some thoughs:
* Lib/sets.py benefitted significantly from itertools and METH_COEXIST.
* The dunder methods are part of the public API. Serhiy's persona tastes aside, there is no reason not to use them like any other method.
* Given a performance trade-off between classes and subclasses, almost universally we give preference to the parent class.
* The folks who use itertools with __getitem__ and __contains__ almost always do so because they care about speed and have a preference for a functional style. Removing the current optimization would directly hit those folks and their style of coding, resulting in code that used to be fast and elegant becoming slow.
----------
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue34396>
_______________________________________
More information about the Python-bugs-list
mailing list