Repository navigation
perf(frames): scan for binding-slot attributes once, after the bind tier installs - #4058
Conversation
…ier installs While the bind tier was announced or loading but not resident, every frame's slot walk visited every element to check for `_s:*` attributes, then the tier install's flush walked again and parsed them. The held walk now visits comments only and marks the frame held; the flush does the single scan. HN story page with binding slots: 20,750 -> 10,375 elements visited, 15,308 -> 7,658 attribute reads. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LZkrATgvFJjgFRdDB4Drcq
🦋 Changeset detectedLatest commit: b111d5a The changes in this PR will be included in the next version bump. This PR includes changesets to release 13 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Size (brotli, eager entry chunk)
|
Coverage Report for CI Build 38593898440Coverage remained the same at 77.515%Details
Uncovered ChangesNo uncovered changes found. Coverage RegressionsNo coverage regressions found. Coverage Stats
💛 - Coveralls |
Merging this PR will not alter performance
|
|
CodSpeed flags
The benchmark job was re-run once and still flagged. This needs acknowledging on CodSpeed, or a fresh base run on Generated by Claude Code |
Fold the held case into `bind` before the walk instead of adding a separate `scan` flag, so the walk loop compiles as on `next` for every page that doesn't scan. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LZkrATgvFJjgFRdDB4Drcq
…alk as on next The held case now passes no element map to `collectSlots`, so the walk itself is byte-identical to `next`; `found.b` is noted before the walk. CodSpeed flagged the announced-without-bind adoption walk at -7% with the check inside `collectSlots`, though its path was unchanged. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LZkrATgvFJjgFRdDB4Drcq
Re-measures the frames eager cap on top of #4055: 11,540 B brotli / 34,499 B minified. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01KRieFbP8sapvTBygyVm3mg
Before: on a page that announces the bind tier, every frame's slot walk visited every element looking for
_s:*attributes while the tier was still loading. That work was thrown away, and after the tier installed the flush walked the page again and parsed the attributes. On the HN story page with binding slots, that came to 20,750 elements visited and 15,308 attribute reads.After: while the tier is announced or loading but not yet resident, the walk visits comments only and marks the frame held. The install's flush does the one element scan. On the same page that is 10,375 elements and 7,658 attribute reads, and
hasSlotMarker(~36 ms at 4x CPU) drops out of the profile.Behavior note: once a page announces the bind tier, a frame with no
_s:*attributes now also waits for that tier before it resolves. The tier is already loading because of the announcement, so the wait is bounded by that load. Pages that don't announce the tier, and pages where the tier is already resident, behave as before. Client slots (regions tier only) never ran the element scan, so they aren't affected.How: before the walk,
collectSlotschecks for the held case (bind && !B && (tierLoads.bind || announced)). In that case it setselements.band turnsbindoff, so the walk loop itself is unchanged fromnext. A new test intier-bind-announced-gate.spec.tsxcounts element-visiting TreeWalkers: none while the frame is held, exactly one after release. The test fails without the fix.Size: frames eager consumer goes 11,495 -> 11,509 B brotli (+14), and 34,411 -> 34,449 B minified. The cap is raised to that measurement and is pending the maintainer's OK. This PR also updates the #4042 note to say that cap was accepted on merge.
🤖 Generated with Claude Code
https://claude.ai/code/session_01LZkrATgvFJjgFRdDB4Drcq