[issue35719] Optimize multi-argument math functions
Serhiy Storchaka
report at bugs.python.org
Fri Jan 11 13:17:26 EST 2019
New submission from Serhiy Storchaka <storchaka+cpython at gmail.com>:
The proposed PR makes multi-argument functions in the math module atan2(), copysign(), remainder() and hypot() to use the fast call convention and inline arguments tuple unpacking.
Results:
$ ./python -m timeit -s "from math import atan2" "atan2(1.0, 1.0)"
Unpatched: 5000000 loops, best of 5: 79.5 nsec per loop
Patched: 5000000 loops, best of 5: 66.1 nsec per loop
$ ./python -m timeit -s "from math import copysign" "copysign(1.0, 1.0)"
Unpatched: 5000000 loops, best of 5: 90.3 nsec per loop
Patched: 10000000 loops, best of 5: 35.9 nsec per loop
$ ./python -m timeit -s "from math import remainder" "remainder(1.0, 1.0)"
Unpatched: 5000000 loops, best of 5: 69.5 nsec per loop
Patched: 5000000 loops, best of 5: 44.5 nsec per loop
$ ./python -m timeit -s "from math import hypot" "hypot(1.0, 1.0)"
Unpatched: 5000000 loops, best of 5: 63.6 nsec per loop
Patched: 5000000 loops, best of 5: 47.4 nsec per loop
----------
components: Extension Modules
messages: 333497
nosy: mark.dickinson, rhettinger, serhiy.storchaka, stutzbach, vstinner
priority: normal
severity: normal
status: open
title: Optimize multi-argument math functions
type: performance
versions: Python 3.8
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue35719>
_______________________________________
More information about the Python-bugs-list
mailing list