New submission from Serhiy Storchaka <storchaka+cpyt...@gmail.com>:
int.__round__ was not converted to Argument Clinic because it is not impossible to express a correct signature for it in Python. But now we can at least make Argument Clinic not producing incorrect signature. And converting to Argument Clinic has a performance benefit. $ ./python -m pyperf timeit -q --compare-to=../cpython-baseline/python "round(12345)" Mean +- std dev: [/home/serhiy/py/cpython-baseline/python] 123 ns +- 6 ns -> [/home/serhiy/py/cpython-release/python] 94.4 ns +- 2.4 ns: 1.31x faster (-23%) $ ./python -m pyperf timeit -q --compare-to=../cpython-baseline/python "round(12345, 0)" Mean +- std dev: [/home/serhiy/py/cpython-baseline/python] 159 ns +- 4 ns -> [/home/serhiy/py/cpython-release/python] 98.6 ns +- 2.4 ns: 1.61x faster (-38%) $ ./python -m pyperf timeit -q --compare-to=../cpython-baseline/python "round(12345, -2)" Mean +- std dev: [/home/serhiy/py/cpython-baseline/python] 585 ns +- 9 ns -> [/home/serhiy/py/cpython-release/python] 534 ns +- 14 ns: 1.09x faster (-9%) ---------- components: Argument Clinic, Interpreter Core messages: 373963 nosy: larry, serhiy.storchaka priority: normal severity: normal status: open title: Convert int.__round__ to Argument Clinic type: performance versions: Python 3.10 _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue41342> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com