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.

Title: Reduce de-optimization in BINARY_OP_INPLACE_ADD_UNICODE
Type: performance Stage: patch review
Components: Interpreter Core Versions: Python 3.11
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: Dennis Sweeney, Mark.Shannon, brandtbucher
Priority: normal Keywords: patch

Created on 2022-03-17 22:44 by Dennis Sweeney, last changed 2022-04-11 14:59 by admin.

Pull Requests
URL Status Linked Edit
PR 31318 merged Dennis Sweeney, 2022-03-17 22:45
PR 32122 merged Dennis Sweeney, 2022-03-26 07:51
Messages (3)
msg415455 - (view) Author: Dennis Sweeney (Dennis Sweeney) * (Python committer) Date: 2022-03-17 22:44
There was a discussion here:

Checking for whether the assignment target is the left-hand side, rather than just checking for the right refcount, is more stable and reduces the number of deoptimizations, and even increases performance on some benchmarks.

Note that `PyUnicode_Append` is already a somewhat expensive function that already checks for the right reference counts, so it's fine to let as much code as possible get there, even if it will take the slow path -- we mostly just want to reduce allocations and avoid the quadratic string concatenation otherwise.
msg416008 - (view) Author: Mark Shannon (Mark.Shannon) * (Python committer) Date: 2022-03-25 16:13
New changeset cca43b7d64f47ea921d0f7a347ae1a839c5463c3 by Dennis Sweeney in branch 'main':
bpo-47053: Reduce deoptimization in BINARY_OP_INPLACE_ADD_UNICODE (GH-31318)
msg416238 - (view) Author: Dennis Sweeney (Dennis Sweeney) * (Python committer) Date: 2022-03-29 02:07
New changeset 788154919c2d843a0a995994bf2aed2d074761ec by Dennis Sweeney in branch 'main':
bpo-47053: Refactor BINARY_OP_INPLACE_ADD_UNICODE (GH-32122)
Date User Action Args
2022-04-11 14:59:57adminsetgithub: 91209
2022-03-29 02:07:19Dennis Sweeneysetmessages: + msg416238
2022-03-26 07:51:23Dennis Sweeneysetpull_requests: + pull_request30202
2022-03-25 16:13:27Mark.Shannonsetnosy: + Mark.Shannon
messages: + msg416008
2022-03-17 22:50:51Dennis Sweeneysettype: security -> performance
2022-03-17 22:45:49Dennis Sweeneysetkeywords: + patch
stage: patch review
pull_requests: + pull_request30058
2022-03-17 22:44:38Dennis Sweeneycreate