[issue43287] Use PEP 590 vectorcall to speed up calls to filter()

Raymond Hettinger report at bugs.python.org
Sun Feb 21 13:40:56 EST 2021


Raymond Hettinger <raymond.hettinger at gmail.com> added the comment:

+0 I don't see any downside.

Note, the benchmark only times instantiation of the filter object.  It doesn't actually run the iterator which is where most of the runtime cost is spent.  So in actual code there is almost zero benefit.  For example, add "list" to the statement:   stmt="b = list(filter(lambda x: x % 2 == 0, a))" and the improvement disappears.

----------
nosy: +rhettinger

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue43287>
_______________________________________


More information about the Python-bugs-list mailing list