Simplify ArrayIterator to a cached length and a position counter - #21598
Open
NullVoxPopuli wants to merge 1 commit into
Open
Simplify ArrayIterator to a cached length and a position counter#21598NullVoxPopuli wants to merge 1 commit into
NullVoxPopuli wants to merge 1 commit into
Conversation
Split out of nvp/simplify-some-vm-hot-paths. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Contributor
Author
|
Benchmark: Ran via
|
johanrd
reviewed
Sep 10, 2026
| let memo = ++this.pos; | ||
|
|
||
| let { keyFor } = this; | ||
| if (memo >= this.length) return null; |
Contributor
There was a problem hiding this comment.
will this also need to account for live array mutations during render?
-if (memo >= this.length) return null;
+if (memo >= this.iterator.length) return null;
Contributor
|
very cool work! |
johanrd
added a commit
to johanrd/ember.js
that referenced
this pull request
Sep 10, 2026
Logs how many blocks render when the backing array is truncated by user code that runs during iteration. On emberjs#21598. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01A8ja8hgWMpTns6ezSXEMzr
johanrd
added a commit
to johanrd/ember.js
that referenced
this pull request
Sep 10, 2026
Logs how many blocks render when the backing array is truncated by user code that runs during iteration. On the emberjs#21598 base. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01A8ja8hgWMpTns6ezSXEMzr
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.
Drops the
currentstate object thatArrayIteratorallocated per list and tracks progress with a position counter and a cached length instead.The length is still read in the constructor so a tracked array's tag is consumed inside the iterator reference's tracking frame.