8000 Reuse objects with refcount == 1 in specialized instructions · Issue #102300 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

Reuse objects with refcount == 1 in specialized instructions #102300

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
markshannon opened this issue Feb 27, 2023 · 1 comment
Closed

Reuse objects with refcount == 1 in specialized instructions #102300

markshannon opened this issue Feb 27, 2023 · 1 comment
Labels
interpreter-core (Objects, Python, Grammar, and Parser dirs) performance Performance or resource usage

Comments

@markshannon
Copy link
Member
markshannon commented Feb 27, 2023

Many VM instructions consume references to their operands and produce a reference to a result, often of the same type.
For some of those, we specialize for common types.

We can speed up the operations by reusing one of the operands if the refcount is one.
For example, in BINARY_OP_ADD_FLOAT if the refcount of the left operand is one, we can do the operation in place.
This is effectively free as we need to check the refcount of the operands in Py_DECREF() anyway.

We have attempted doing this in the past, but got bogged down trying to merge the operation and the following store.

Linked PRs

@markshannon markshannon added the performance Performance or resource usage label Feb 27, 2023
warsaw pushed a commit to warsaw/cpython that referenced this issue Apr 11, 2023
@iritkatriel iritkatriel added the interpreter-core (Objects, Python, Grammar, and Parser dirs) label Nov 27, 2023
@hugovk
Copy link
Member
hugovk commented Mar 15, 2024

Closing, the linked PR has been merged.

@hugovk hugovk closed this as completed Mar 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
interpreter-core (Objects, Python, Grammar, and Parser dirs) performance Performance or resource usage
Projects
None yet
Development

No branches or pull requests

3 participants
0