New submission from Dennis Sweeney <sweeney.dennis...@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 <rep...@bugs.python.org>
<https://bugs.python.org/issue47053>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to