You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 9f465d5
Browse filesBrowse the repository at this point in the historyBrowse files
test(web,signals): tier-1 coverage for the headless-UI props chain
Every element a component library like Kobalte renders is reached through
a stack of merge(defaults) → omit(consumed) → mergeProps(call-site statics)
layers ending in a polymorphic `dynamic(() => props.as)` and one spread.
Nothing in the repo measured or pinned that shape: the existing utilities
and spread benches exercise one merge, one omit, or one spread in
isolation, and each looks cheap. The chain is where the cost lives — every
layer re-processes every key of the layer below — and it was invisible to
CodSpeed.
One shared fixture (`test/harness/polymorphic.tsx`: Dialog.Trigger →
Button.Root → Polymorphic, plus a compiled floor twin rendering the same
`<a>`) feeds all of:
- `web/test/polymorphic-chain.bench.tsx` — DOM lane: mount+clear 1k rows,
update 10th ×16, owner-drift gated. Chain vs compiled floor.
- `web/test/server/polymorphic-chain.bench.tsx` — SSR lane: renderToString
of 200 rows, chain vs floor. Construction cost only; no update phase to
amortize it.
- `signals/tests/store/props-chain.bench.ts` — the pure merge/omit chain at
depth 1/3/7, build and build+consume reported separately so a change that
moves cost between construction and read is visible.
- Parity-harness scenarios `polymorphic-chain` and
`polymorphic-chain-compiled-floor`: hydration ids through the chain,
element identity across an update, adopt-all, no separators.
- `web/test/polymorphic-chain.spec.tsx` / `server/polymorphic-chain.spec.tsx`:
the chain resolves to the floor's exact attribute set (shadowing through
the layers, consumed keys and `as` absent), reactive attrs stay live, the
element is kept across updates; SSR serializes the same set with keys.
- `utilities.test.ts`: chain-shaped semantics for merge/omit — shadowing
order, hidden keys accumulating through nested omits and surviving
re-merges, live reads through every layer, spread-copy snapshot, and the
descriptor kind (data vs getter) surviving to the bottom of the chain.
Baseline on next, per element: SSR chain ≈18× the compiled floor
(≈19 µs vs ≈1 µs), DOM mount ≈2.5×, DOM update ≈2.3×; signals chain
≈21 µs at depth 3, ≈65 µs at depth 7. These are the numbers the props
view work is measured against.
Co-authored-by: Cursor <[email protected]>
0 commit comments