Uh oh!
There was an error while loading. Please reload this page.
gh-134584: Eliminate redundant refcounting from _UNPACK_SEQUENCE_TWO_TUPLE - #142952
gh-134584: Eliminate redundant refcounting from _UNPACK_SEQUENCE_TWO_TUPLE#142952cocolato wants to merge 7 commits into
_UNPACK_SEQUENCE_TWO_TUPLE#142952Conversation
Fidget-Spinner
commented
Dec 18, 2025
I need to discuss with Mark for this one. As it might cause a stack overflow if the stack bounds are exceeded. |
UNPACK_SEQUENCE familymarkshannon
commented
Dec 23, 2025
@cocolato Thanks for the contribution. Unfortunately, I don't think that this transformation is going to be useful. There is potentially an optimization we can do with If we know that the reference to the tuple in |
cocolato
commented
Dec 23, 2025
Thanks for the explanation! I now see that it doesn’t reduce refcount overhead for the common case of consuming new references (return values), so I’ll convert this PR to a draft. I might dig into how the Tier 2 optimizer could track such uniqueness. |
Fidget-Spinner
commented
Jan 1, 2026
@cocolato please reduce this PR to just |
UNPACK_SEQUENCE family_UNPACK_SEQUENCE_TWO_TUPLE
I have reduced this PR to |
Uh oh!
There was an error while loading. Please reload this page.
Fidget-Spinner
commented
Jan 2, 2026
Cool! I think you can skip those for now and wait till we can do what Mark suggested. Let me know if you need any help understanding the implementation. |
Fidget-Spinner
commented
Jan 2, 2026
Hmm thinking about this further, I think Mark is right. I'm really sorry for asking you to reduce the PR! We need to track unique references to get the most benefit. |
Hi, I want to confirm: if we implement "Unique Reference Tracking", should we track only the current cpython/Include/internal/pycore_optimizer.h Lines 196 to 204 in 9609574 |
cocolato
commented
Jan 4, 2026
Or should we open a new issue? |
Fidget-Spinner
commented
Jan 4, 2026
@cocolato open a new issue for this please, thank you. You can start small with just tuple ops for now, then we can expand in the future. |
Fidget-Spinner
commented
Jan 4, 2026
|
Uh oh!
There was an error while loading. Please reload this page.