This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Optimize multi-argument math functions
Type: performance Stage: resolved
Components: Extension Modules Versions: Python 3.8
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: mark.dickinson, rhettinger, serhiy.storchaka, stutzbach, vstinner
Priority: normal Keywords: patch, patch, patch

Created on 2019-01-11 18:17 by serhiy.storchaka, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 11527 merged serhiy.storchaka, 2019-01-11 18:25
PR 11527 merged serhiy.storchaka, 2019-01-11 18:25
PR 11527 merged serhiy.storchaka, 2019-01-11 18:25
Messages (2)
msg333497 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2019-01-11 18:17
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
msg333514 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2019-01-12 06:26
New changeset d0d3e99120b19a4b800f0f381b2807c93aeecf0e by Serhiy Storchaka in branch 'master':
bpo-35719: Optimize multi-argument math functions. (GH-11527)
https://github.com/python/cpython/commit/d0d3e99120b19a4b800f0f381b2807c93aeecf0e
History
Date User Action Args
2022-04-11 14:59:10adminsetgithub: 79900
2019-01-12 06:27:16serhiy.storchakasetkeywords: patch, patch, patch
status: open -> closed
resolution: fixed
stage: patch review -> resolved
2019-01-12 06:26:37serhiy.storchakasetmessages: + msg333514
2019-01-11 18:25:32serhiy.storchakasetkeywords: + patch
stage: patch review
pull_requests: + pull_request11115
2019-01-11 18:25:24serhiy.storchakasetkeywords: + patch
stage: (no value)
pull_requests: + pull_request11114
2019-01-11 18:25:15serhiy.storchakasetkeywords: + patch
stage: (no value)
pull_requests: + pull_request11113
2019-01-11 18:17:24serhiy.storchakacreate