Issue 41922: Use PEP 590 vectorcall to speed up calls to reversed() - Python tracker

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
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 2022-04-11 14:59 by admin. 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!