STINNER Victor added the comment: bench_fastcall_partial.py: more complete microbenchmark.
I rewrote my patch: * I added _PyObject_HasFastCall(callable): return 1 if callable supports FASTCALL calling convention for positional arguments * I splitted partial_call() into 2 subfunctions: partial_fastcall() is specialized for FASTCALL, partial_call_impl() uses PyObject_Call() with a tuple for positional arguments The patch fixes the performance regression for VARARGS and optimize FASTCALL: haypo@smithers$ ./python -m perf compare_to ref.json patch.json --table +-----------------------------+---------+------------------------------+ | Benchmark | ref | patch | +=============================+=========+==============================+ | partial Python, 1+1 arg | 135 ns | 118 ns: 1.15x faster (-13%) | +-----------------------------+---------+------------------------------+ | partial Python, 2+0 arg | 114 ns | 91.4 ns: 1.25x faster (-20%) | +-----------------------------+---------+------------------------------+ | partial Python, 5+1 arg | 151 ns | 135 ns: 1.12x faster (-11%) | +-----------------------------+---------+------------------------------+ | partial Python, 5+5 arg | 192 ns | 168 ns: 1.15x faster (-13%) | +-----------------------------+---------+------------------------------+ | partial C VARARGS, 2+0 arg | 153 ns | 127 ns: 1.20x faster (-17%) | +-----------------------------+---------+------------------------------+ | partial C FASTCALL, 1+1 arg | 111 ns | 93.7 ns: 1.18x faster (-15%) | +-----------------------------+---------+------------------------------+ | partial C FASTCALL, 2+0 arg | 63.9 ns | 64.6 ns: 1.01x slower (+1%) | +-----------------------------+---------+------------------------------+ Not significant (1): partial C VARARGS, 1+1 arg ---------- Added file: http://bugs.python.org/file46725/bench_fastcall_partial.py _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue29735> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com