Repository navigation
Description
Depends on: #1 landed (bail decisions need sameUniversalHostPropValue; identity-compared fresh props lists never bail). This is the dominant remaining point-update gap: post-#1, select@10k is 857ms vs vue-vdom 164 / react 170 — nearly all of it background replay breadth.
The measured problem
The owner for selected state is the list-owning component, so universalFor re-runs its item lambda for ALL 10k rows on every select — 10k fresh universalProps arrays, 10k universalValue wrappers, 10k record diffs — for a change affecting 2 rows. Compiled shape:
universalFor(rows, (row,i) => row.id, (row,i) =>
universalValue(plan1, [ universalComponent('lynx', Row, universalProps([
["set","row",row], ["set","isSelected", selected===row.id],
["set","onSelect", select], ["set","onRemove", remove] ])) ]))Ceiling anchor: the ReactLynx bench app with hand-written memo(Row) does select@10k in ~170ms. React makes users write memo; octane's compiler sees every @for item and its full props list — automating the bail is the thing octane is better positioned to do than React. (README already claims memo bailouts — first find why the universal path doesn't get them before writing new machinery.)
Change
- At the
universalComponentreconcile boundary inuniversal-core.ts: identical component reference + props list equal by value (per-entry["set", key, value], values viasameUniversalHostPropValue) ⇒ skip re-rendering that child owner entirely — retain records, emit nothing. - Context correctness: a bailed subtree still re-renders when a context it consumes changes (bail means "props didn't change", never "nothing changed"). Explicit test: context update through a memo-bailed @for item.
- Compiler assist (
compile-universal.js): mark @for item lambdas whose output depends only on (item, index, provably-stable captures) as memo-eligible — the hook-deps closure analysis already computes this; unstable captures opt out (correct-by-default). No new user-facing API; an opt-OUT directive is acceptable.
Constraints
- React-memo semantics: bail ⇒ no render, no effects re-run, refs stable.
- Keyed reorder (LIS path) still works on bailed items: moves without re-renders (cover
swapRows). - Suspense/error/Activity boundaries inside items keep their retained-episode bookkeeping.
Acceptance (rig)
- Deterministic: item-renders counter on select@1k drops 1000 → 2; update10th@10k renders exactly the changed rows.
- select@10k lands in the 150–250ms band (references: vue-vdom 164 / react 170 same host); update10th@10k in the 200–350ms band.
- All universal suites green (event-scope, portals, composition); create/FCP untouched.
Activity
Huxpro commentedon Aug 9, 2026
Implemented in #11 (stacked on #10 → #1). Measured outcome, and one finding that changed the shape of the fix:
The README's memo-bailout claim was one predicate away from true on Lynx. Following this issue's directive ("first find why the universal path doesn't get them"), the answer turned out to be: octanejs#587 already landed generic retained-subtree adoption at the
universalComponentreconcile boundary — identical component + shallow-equal props + stable consumed contexts + no pending updates ⇒ adopt the committed subtree, render nothing, emit nothing — butretainEligibleexcluded transported roots wholesale. The transport commit machinery was already adoption-safe (whole-tree version acknowledgement, in-place listener-table edits that only retire re-staged hosts, monotonic universal IDs), so the fix is removing that one exclusion, plus regression tests. No new reconcile machinery and no compiler assist needed — the adoption boundary fires for any@foritem that renders a component child, which is the compiled shape quoted above.Deterministic acceptance (rig, drift-checked, wire counters byte-identical before/after):
Context correctness is pinned by a new test: a theme change through retained-prop
@foritems re-renders all of them, and they re-adopt once the provider settles. Effects don't re-run, listeners announced at mount keep dispatching across retained commits, LIS reorder moves adopted subtrees with zero renders. 8 new ratio guards; red-check breaches them at 10×/500×.Wall clock (same host, back-to-back, medians n=3), @10k:
select@1k reaches vue-vdom parity (28ms vs 24, 1.15×), and both 10k storms now beat vue-vdom outright and land at vue-vapor's level. The 150–250 / 200–350 bands are not fully reached (274 / 473): what remains is the O(N) item-lambda re-run itself — 10k fresh
universalPropsarrays + descriptor allocations + shallow-compares per parent render — which adoption by design does not remove. That's the honest residual for the remaining ~130/~200ms, a candidate follow-up alongside #5/#7.One deliberate deviation from the sketch above: the bail predicate stays
Object.isshallow-equality (exact React memo semantics) rather than per-entrysameUniversalHostPropValue— the compiled@forshape passes identity-stable rows and useCallback-stable handlers, so identity comparison already meets every acceptance floor. The value-semantic predicate stays available as a follow-up if real apps pass fresh-but-equal props objects.Also newly measured while adding the swap op: a rows-1↔998 transposition costs 997 move commands against the 2-move model (LIS moves the spanned window; final order and survivor identity are the contract, move-set minimality is not). Pinned as a KNOWN GAP waterline guard so it can't silently grow.
Generated by Claude Code
Huxpro commentedon Aug 11, 2026
Live-main audit (2026-08-11): landed upstream as octanejs#696. Upstream explicitly carried the Huxpro #11 retained transported-subtree mechanism: select executes two Row bodies and update10th executes only changed rows. Closing the fork issue as completed.