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

Created on 2020-09-27 13:20 by corona10, last changed 2020-10-01 04:52 by corona10. This issue is now closed.

Files
File name Uploaded Description Edit
bench_bool.py corona10, 2020-09-27 13:20
Pull Requests
URL Status Linked Edit
PR 22427 merged corona10, 2020-09-27 13:24
PR 22462 merged corona10, 2020-09-30 13:37
Messages (7)
msg377565 - (view) Author: Dong-hee Na (corona10) * (Python committer) Date: 2020-09-27 13:20
bool type is well-used builtin types, I noticed that if we use vector call to bool type, it shows the awesome performance enhancement.

Mean +- std dev: [master] 91.4 us +- 3.3 us -> [vectorcall] 48.6 us +- 3.1 us: 1.88x faster (-47%)
msg377605 - (view) Author: Dong-hee Na (corona10) * (Python committer) Date: 2020-09-28 16:16
New changeset a195bceff7b552c5f86dec7894ff24dcc87235da by Dong-hee Na in branch 'master':
bpo-41870: Use PEP 590 vectorcall to speed up bool()  (GH-22427)
https://github.com/python/cpython/commit/a195bceff7b552c5f86dec7894ff24dcc87235da
msg377606 - (view) Author: Dong-hee Na (corona10) * (Python committer) Date: 2020-09-28 16:17
Now I close this issue.
Thank you, Mark!
msg377613 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2020-09-28 18:41
You can put ok<0 test in the if (nargs) branch, to avoid the test when nargs=0.
msg377686 - (view) Author: Pablo Galindo Salgado (pablogsal) * (Python committer) Date: 2020-09-29 21:56
> You can put ok<0 test in the if (nargs) branch, to avoid the test when nargs=0.
 
+1
msg377735 - (view) Author: Dong-hee Na (corona10) * (Python committer) Date: 2020-10-01 04:50
New changeset fa7ce080175f65d678a7d5756c94f82887fc9803 by Dong-hee Na in branch 'master':
bpo-41870: Avoid the test when nargs=0 (GH-22462)
https://github.com/python/cpython/commit/fa7ce080175f65d678a7d5756c94f82887fc9803
msg377736 - (view) Author: Dong-hee Na (corona10) * (Python committer) Date: 2020-10-01 04:52
Now the suggestion is applied!
Thank you Pablo and Victor!!!
History
Date User Action Args
2020-10-01 04:52:35corona10setstatus: open -> closed
resolution: fixed
messages: + msg377736

stage: patch review -> resolved
2020-10-01 04:50:47corona10setmessages: + msg377735
2020-09-30 13:38:08corona10setpull_requests: - pull_request21486
2020-09-30 13:37:29corona10setpull_requests: + pull_request21488
2020-09-30 01:34:54corona10setpull_requests: + pull_request21486
2020-09-29 21:56:09pablogsalsetnosy: + pablogsal
messages: + msg377686
2020-09-28 18:41:35vstinnersetmessages: + msg377613
2020-09-28 16:17:17corona10setnosy: + Mark.Shannon
messages: + msg377606
2020-09-28 16:16:26corona10setmessages: + msg377605
2020-09-27 13:26:28corona10setcomponents: + Interpreter Core
2020-09-27 13:24:00corona10setkeywords: + patch
stage: patch review
pull_requests: + pull_request21461
2020-09-27 13:20:58corona10create