bpo-26110: Add ``CALL_METHOD_KW`` opcode to speedup method calls with keywords by Fidget-Spinner · Pull Request #26014 · python/cpython
I'll post pyperformance results here shortly (hopefully by tomorrow).
Edit1: non-scientific timeit microbenchmark results (unfortunately not pyperf timeit :( ) show a roughly 25% time reduction:
python.exe -m timeit -s "
>> class X:
>> def foo(self, b, *, c=1, d=2): ...
>> x = X()
>> " "x.foo(2,c=3,d=4)"
# Without the patch (from main):
2000000 loops, best of 5: 146 nsec per loop
# With the CALL_METHOD_KW patch applied:
2000000 loops, best of 5: 107 nsec per loop
Edit2: pyperformance shows no significant change (once again likely because keyword args in method calls aren't common in pyperformance).