Skip to content

GH-120024: Change LOAD_FAST instructions to LOAD_FAST_TEMP when it is guaranteed the reference is consumed immediately. - #125192

Closed
markshannon wants to merge 6 commits into
python:mainfrom
faster-cpython:mark-load-fast-deferred-for-guaranteed-consumed-refs
Closed

GH-120024: Change LOAD_FAST instructions to LOAD_FAST_TEMP when it is guaranteed the reference is consumed immediately.#125192
markshannon wants to merge 6 commits into
python:mainfrom
faster-cpython:mark-load-fast-deferred-for-guaranteed-consumed-refs

Conversation

@markshannon

@markshannonmarkshannon commented Oct 9, 2024

Copy link
Copy Markdown
Member

This PR adds a LOAD_FAST_TEMP instruction for loading locals to the evaluation stack that are used as short-lived values within an expression. Distinguishing these LOAD_FAST instructions will allow us to avoid expensive reference counting operations in these cases.

This is marked as draft, as it has no value until the default build supports reference counts in tags.

The stats show that 3/4 of all LOAD_FAST (including the LOAD_FASTs in LOAD_FAST_LOAD_FAST) are converted to LOAD_FAST_TEMP.

Before merging, a few tests need fixing and the choice of superinstructions needs updating.

@markshannonmarkshannon changed the title Mark load fast deferred for guaranteed consumed refsGH-120024: Change LOAD_FAST instructions to LOAD_FAST_TEMP when it is guaranteed the reference is consumed immediately.Oct 9, 2024
@bedevere-appbedevere-appBot mentioned this pull request Oct 9, 2024
@markshannon

Copy link
Copy Markdown
MemberAuthor

Superseded by #130708

@markshannon
markshannon deleted the mark-load-fast-deferred-for-guaranteed-consumed-refs branch March 3, 2025 11:26
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

@markshannon