classification
Title: Use PEP 590 vectorcall to speed up calls to reversed()
Type: performance Stage: resolved
Components: Interpreter Core Versions: Python 3.10
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: corona10 Nosy List: corona10, pablogsal, vstinner
Priority: normal Keywords: patch

Created on 2020-10-03 16:00 by corona10, last changed 2020-10-03 17:19 by corona10. This issue is now closed.

Files
File name Uploaded Description Edit
bench_reversed.py corona10, 2020-10-03 16:00
Pull Requests
URL Status Linked Edit
PR 22523 merged corona10, 2020-10-03 16:06
Messages (3)
msg377889 - (view) Author: Dong-hee Na (corona10) * (Python committer) Date: 2020-10-03 16:00
reversed is also a very well-used type.
if shows 10+ percent performance improvement from baseline and this metric.
And this improvement looks acceptable from viewing builtin types which are applied PEP 590 (frozenset, list, set, dict)  

reversed creation + for loop
Mean +- std dev: [reversed_master] 157 ns +- 4 ns -> [reversed_opt] 139 ns +- 2 ns: 1.13x faster (-11%)

reversed creation
Mean +- std dev: [reversed2_master] 118 ns +- 2 ns -> [reversed2_opt] 101 ns +- 2 ns: 1.18x faster (-15%)
msg377894 - (view) Author: Dong-hee Na (corona10) * (Python committer) Date: 2020-10-03 17:17
New changeset d646e91f5c4f4b76f96494103d440ed0b6257425 by Dong-hee Na in branch 'master':
bpo-41922: Use PEP 590 vectorcall to speed up reversed() (GH-22523)
https://github.com/python/cpython/commit/d646e91f5c4f4b76f96494103d440ed0b6257425
msg377895 - (view) Author: Dong-hee Na (corona10) * (Python committer) Date: 2020-10-03 17:18
Thank you Victor!
History
Date User Action Args
2020-10-03 17:19:09corona10setstatus: open -> closed
resolution: fixed
stage: patch review -> resolved
2020-10-03 17:18:54corona10setstatus: closed -> open
resolution: fixed -> (no value)
messages: + msg377895

stage: resolved -> patch review
2020-10-03 17:17:15corona10setstatus: open -> closed
resolution: fixed
stage: patch review -> resolved
2020-10-03 17:17:03corona10setmessages: + msg377894
2020-10-03 16:06:34corona10setkeywords: + patch
stage: patch review
pull_requests: + pull_request21529
2020-10-03 16:01:02corona10setassignee: corona10
2020-10-03 16:00:56corona10create