Draft
Conversation
Contributor
|
|
||
| if (Array.isArray(iterable)) { | ||
| return new ArrayIterator(iterable, keyFor); | ||
| // When iterating a TrackedArray (Proxy), each index access goes through |
Contributor
There was a problem hiding this comment.
well this is dubious lol
| #collection = createUpdatableTag(); | ||
|
|
||
| #storages = new Map<number, ReturnType<typeof createUpdatableTag>>(); | ||
| // Use a flat array instead of Map for index-based storage lookups. |
Correctness fixes: - validators.ts: Restore try/finally for isUpdating recovery, use > with NaN fallback for volatile tag propagation - reference.ts: Use track() for error-safe tracking frames (try/catch in valueForRef kills V8 JIT optimization) - iterable.ts: Don't reuse iterator result objects (callers store refs) - tracking.ts: Avoid corrupting combinator tags when pooling trackers Performance optimizations: - reference.ts: Fast path for iterator item refs — skip tracking frame and closures entirely since compute only consumes one tag. Eliminates ~40,000 allocations per 5000-item list render. - destroyable: Swap-and-pop removal instead of indexOf+splice, reducing array shifting from O(n) to O(1) per removal. - element-builder.ts: Eliminate First/Last wrapper class allocations, store raw SimpleNode references with boolean discriminator. - tracking.ts: Hand off tags array to combine() instead of slice() copy. Remove unwrap() from hot endTrackFrame path. - update.ts: Remove bulk-clear code that was slower than single-pass (3 passes over data vs 1). - stack.ts: Fast path for capture(0). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Bug fixes: - validators.ts: Move isUpdating check BEFORE lastChecked early return. During cycle detection, lastChecked is already set to $REVISION, so the early return was firing before the cycle could be detected. - iterable.ts: Handle empty arrays in ArrayIterator.next() — return null instead of producing a spurious item with undefined value. - reference.ts: Use track() for error-safe tracking (try/catch in valueForRef or separate function both kill V8 JIT optimization). Performance optimizations: - reference.ts: Fast path for iterator item refs — skip tracking frame and closures entirely (~40,000 fewer allocations per 5000-item render). - destroyable: Swap-and-pop removal instead of indexOf+splice. - element-builder.ts: Eliminate First/Last wrapper allocations. - tracking.ts: Hand off tags array instead of slice(); remove unwrap() from hot endTrackFrame path. - update.ts: Remove slower bulk-clear code. - stack.ts: Fast path for capture(0). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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.

note from nvp: