[New-bugs-announce] [issue47053] Reduce de-optimization in BINARY_OP_INPLACE_ADD_UNICODE

Dennis Sweeney report at bugs.python.org
Thu Mar 17 18:44:38 EDT 2022


New submission from Dennis Sweeney <sweeney.dennis650 at gmail.com>:

There was a discussion here: https://github.com/faster-cpython/ideas/discussions/269

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.

----------
components: Interpreter Core
messages: 415455
nosy: Dennis Sweeney, brandtbucher
priority: normal
severity: normal
status: open
title: Reduce de-optimization in BINARY_OP_INPLACE_ADD_UNICODE
type: security
versions: Python 3.11

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue47053>
_______________________________________


More information about the New-bugs-announce mailing list