Repository navigation
test(lynx): pin what a recycled list cell spends at the host boundary - #259
Merged
Merged
Conversation
Issue #193's Layer 1 sketch prices recycling-as-slot-writes as something program-per-cell would buy -- "no teardown, no re-describe". Neither is what the renderer does today, so the sketch would have banked a saving that is already banked. This counts the boundary rather than arguing about it. Recycling one physical cell from row 0 to row 617 of a deferred run, against the same three-host row a fresh materialize builds: fresh 3 createElement, 3 insertBefore, 1 setClasses, 2 setAttribute, 2 setRefSelector, 2 getUniqueId, 1 flush -- 14 calls recycle 0 createElement, 0 insertBefore, 0 setClasses, 2 setAttribute, 2 setRefSelector, 2 getUniqueId, 1 flush -- 7 calls The two writes are exactly the two bound slots. `class` is static in the program, so the patch finds nothing on it and `setClasses` never runs -- the prop diff pays for itself here rather than costing. The two `setRefSelector` calls are not waste: the selector encodes the host id, which genuinely changes when a cell changes rows. So a compiled rebind could not issue fewer host calls than these, only decide them for less. What the count cannot see is where that deciding happens -- the record and frozen prop bag `resolveRecord` allocates per host, the patch `planLynxHostPropPatch` computes to rediscover which names a run already says are the only ones that vary, and the event set torn down and reinstalled per host. Issue #195 R2 measured that script at 73% of the callback wall on device against ~8 ms/window of element and crossing, so a near-minimal count here does not mean a recycle is cheap: it locates the remaining cost off this boundary, which is the finding. Seen red three ways before being trusted: a recycle that re-describes the row instead of diffing against what the cell holds, one that never reuses a pooled cell, and a materialization that does not retain what it derived. Each turns this test red on its own assertion and restoring turns it green. Test-only, so no changeset. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_019RsC3U39kUuLKajZANeTVy
# Conflicts: # packages/lynx/tests/list-recycling.test.ts
1 task done
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.
Summary
#193's Layer 1 sketch prices recycling-as-slot-writes as something program-per-cell would buy — "no teardown, no re-describe". Neither is what the renderer does today, so the sketch would have banked a saving that is already banked. This counts the boundary rather than arguing about it, and the count is the oracle a later slice has to beat.
Recycling one physical cell from row 0 to row 617 of a deferred run, against the same three-host row a fresh materialize builds:
createElementinsertBeforesetClassessetAttributesetRefSelectorgetUniqueIdflushThe two writes on the recycle are exactly the two bound slots (
item-key→item-617,text→Row 617).classis static in the program, so the patch finds nothing on it andsetClassesnever runs — the prop diff pays for itself here rather than costing. The twosetRefSelectorcalls are not waste: the selector encodes the host id, which genuinely changes when a cell changes rows.So a compiled rebind could not issue fewer host calls than these, only decide them for less.
Why
What the count cannot see is where that deciding happens — the record and frozen prop bag
resolveRecordallocates per host, the patchplanLynxHostPropPatchcomputes to rediscover which names a run already says are the only ones that vary, and the event set torn down and reinstalled per host. #195 R2 measured that script at 73% of the callback wall on device against ~8 ms/window of element+crossing, so a near-minimal count here does not mean a recycle is cheap: it locates the remaining cost off this boundary, which is the finding.The full design reading this supports — including why the emission needs no
rebindentry — is on #193.Changes
packages/lynx/tests/list-recycling.test.ts: one test in the existingLynx deferred template runsblock, reusing that block's fixture. Wraps the Element PAPI in a plain counting object (not a Proxy —createLynxElementPAPIreturns frozen non-configurable members, which a Proxy may not report as anything but themselves).No product code changes, so no changeset.
Validation
pnpm format:check— ranpnpm format:files packages/lynx/tests/list-recycling.test.ts, unchangedpnpm typecheck— exit 0pnpm test— not run in full;npx vitest run --project lynxinsteadnpx vitest run --project lynx— 48 files / 737 passed;pnpm synccleanSeen red three ways before being trusted, each on its own assertion, each restoring green:
rebindPhysicalTreere-describes the row ({}as previous props) instead of diffing against what the cell holdssetClassesmaterializeListItemnever reuses a pooled cellcreateElement/insertBeforeassertionsresolveRecordmaterializes without retainingRisk / follow-ups
A count-pinning test is deliberately brittle: a later Layer 1 slice that changes the recycle path will turn it red, and updating it to the new numbers is the intended workflow rather than a failure.
Branch naming: the harness assigned
claude/octane-issue-66-phase-a-7wz97zfor this session, butcreate-a-prrequires afeat/|fix/|docs/|test/|perf/topic branch solabel-pr.ymlcan read the type. Topic branch used; flagging the conflict rather than resolving it unilaterally.CI on this repo is currently wedged repo-wide —
classify changeset releasenever gets ablacksmith-4vcpu-ubuntu-2404runner and every otherci.ymljob carriesneeds: release_change. Nothing has produced a pass or fail since run 434. Reported at #257; not repeated here.Provenance
agent-authored)Generated by Claude Code