Message373963
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%) |
|
Date |
User |
Action |
Args |
2020-07-19 12:38:29 | serhiy.storchaka | set | recipients:
+ serhiy.storchaka, larry |
2020-07-19 12:38:29 | serhiy.storchaka | set | messageid: <1595162309.27.0.341065260309.issue41342@roundup.psfhosted.org> |
2020-07-19 12:38:29 | serhiy.storchaka | link | issue41342 messages |
2020-07-19 12:38:29 | serhiy.storchaka | create | |
|