Title: Specialize COMPARE_OP
Type: performance Stage: resolved
Components: Interpreter Core Versions: Python 3.11
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: Dennis Sweeney, Mark.Shannon
Priority: normal Keywords: patch

Created on 2021-11-23 21:00 by Dennis Sweeney, last changed 2021-12-03 23:45 by Dennis Sweeney. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 29734 merged Dennis Sweeney, 2021-11-23 21:00
Messages (3)
msg406887 - (view) Author: Dennis Sweeney (Dennis Sweeney) * (Python triager) Date: 2021-11-23 21:00
Some specialization statistics:

Including 3 opcodes: COMPARE_OP_INT and COMPARE_OP_FLOAT and COMPARE_OP_STR (equality only) seems to give pretty good specialization numbers, better than just 2.
msg406930 - (view) Author: Mark Shannon (Mark.Shannon) * (Python committer) Date: 2021-11-24 13:53
Is COMPARE_OP worth specializing by itself?

Most comparisons are followed by a jump, and much of the overhead is in the branching around the choice of operator as well as pushing and popping (with inc/decrefs) a value that has only one bit of information (True/False).
msg407577 - (view) Author: Mark Shannon (Mark.Shannon) * (Python committer) Date: 2021-12-03 11:29
New changeset 03768c4d139df46212a091ed931aad03bec18b57 by Dennis Sweeney in branch 'main':
bpo-45885: Specialize COMPARE_OP (GH-29734)
Date User Action Args
2021-12-03 23:45:56Dennis Sweeneysetstatus: open -> closed
resolution: fixed
stage: patch review -> resolved
2021-12-03 11:29:16Mark.Shannonsetmessages: + msg407577
2021-11-24 13:53:03Mark.Shannonsetnosy: + Mark.Shannon
messages: + msg406930
2021-11-23 21:00:53Dennis Sweeneysetkeywords: + patch
stage: patch review
pull_requests: + pull_request27972
2021-11-23 21:00:24Dennis Sweeneycreate