Repository navigation
gh-162784: Add list fast path for STORE_SLICE and slice helpers - #162785
Open
josh-hurst wants to merge 1 commit into
Open
josh-hurst wants to merge 1 commit into
josh-hurst wants to merge 1 commit into
Conversation
STORE_SLICE list fast path Skip the temporary slice for exact lists. Stage displaced references for equal-length replacements of up to 32 items and release them after all writes. Preserve bound finalization order and iterable conversion errors. Slice helpers Unpack compact integer bounds directly and use a difference to count unit-step slices after normalization.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Route STORE_SLICE on exact lists directly to list assignment. For equal-length replacements of up to 32 items from another exact list or tuple, store all new references before releasing the old ones. The slice helpers also unpack compact integers directly and skip division for unit steps.
Across five paired M4 Pro runs, median fannkuch(9) time fell from 191.765 ms to 162.340 ms. One million eight-item assignments fell from 27.546 ms to 14.476 ms. Self-assignment differed by less than 0.1% on the paired median. Debug and free-threaded tests passed, including reference-leak checks.
Found and written by an AI optimization pipeline I run; I reviewed every line, ran the tests and sanitizers, and can answer for it.