classification
Title: Convert bool.__new__ to argument clinic
Type: performance Stage: resolved
Components: Argument Clinic Versions: Python 3.10
process
Status: closed Resolution: works for me
Dependencies: Superseder:
Assigned To: Nosy List: Dennis Sweeney
Priority: normal Keywords: patch

Created on 2020-07-21 10:00 by Dennis Sweeney, last changed 2020-09-29 18:22 by Dennis Sweeney. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 21581 closed Dennis Sweeney, 2020-07-21 10:01
Messages (3)
msg374058 - (view) Author: Dennis Sweeney (Dennis Sweeney) * Date: 2020-07-21 10:00
Benchmarked on my machine (Windows 10):

.\python.bat -m pyperf timeit -s "from collections import deque; x = [[], [1]] * 1_000_000" "deque(map(bool, x), maxlen=0)"
    
    --- Win32 build configuration ---
    Master:             105 ms +- 2 ms
    With this change:  88.2 ms +- 2.1 ms

    --- x64 build configuration ---
    Master:            80.2 ms +- 1.3 ms
    With this change:  74.2 ms +- 0.5 ms
msg374088 - (view) Author: Dennis Sweeney (Dennis Sweeney) * Date: 2020-07-22 07:39
More microbenchmarks:

pyperf timeit "bool()"
    Before: 63.1 ns +- 0.7 ns
    After:  51.7 ns +- 1.2 ns

pyperf timeit "bool(0)"
    Before: 77.4 ns +- 1.9 ns
    After:  67.2 ns +- 1.3 ns

pyperf timeit "bool(17)"
    Before: 77.3 ns +- 2.3 ns
    After:  67.1 ns +- 1.0 ns
msg377678 - (view) Author: Dennis Sweeney (Dennis Sweeney) * Date: 2020-09-29 18:22
Superseded by https://bugs.python.org/issue41870
History
Date User Action Args
2020-09-29 18:22:09Dennis Sweeneysetstatus: open -> closed

nosy: - larry
messages: + msg377678

resolution: works for me
stage: patch review -> resolved
2020-07-22 07:39:23Dennis Sweeneysetmessages: + msg374088
2020-07-21 10:01:17Dennis Sweeneysetkeywords: + patch
stage: patch review
pull_requests: + pull_request20723
2020-07-21 10:00:36Dennis Sweeneycreate