Repository navigation
perf: retain unchanged Lynx rows across transport commits - #696
Merged
domgan-oai merged 1 commit intoAug 10, 2026
Merged
domgan-oai merged 1 commit into
domgan-oai merged 1 commit into
Conversation
domgan-oai
marked this pull request as ready for review
August 10, 2026 21:01
This was referenced Aug 11, 2026
Closed
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
Extend Octane's existing retained-component subtree adoption to transported universal roots, so changing one or two rows in a Lynx table does not execute every unchanged row component again.
This follows the specific, independently measured fix in Huxpro/octane#11, rather than proposing new compiler machinery, a new transport protocol, or speculative receiver optimization. The performance question is deliberately framed around the actual Lynx-for-Web engine and browser-hosted Element PAPI, not only an inexpensive in-process fake.
Draft status: implementation and same-host before/after Chromium measurements are complete. All affected full framework/build-plugin projects passed 12,531 tests, all eight affected TypeScript configurations passed, and every deterministic Lynx table guard passed.
Why
octanejs/octane#693 made large production-compiled mounts and first native updates competitive with ReactLynx on a shared cheap fake Element PAPI. Its 21-sample in-process 10,000-row results were 44.755 ms versus 47.255 ms for mounting and 7.845 ms versus 8.673 ms for the first update. That benchmark is useful for runtime and host-driver costs, but does not represent real browser DOM work, layout, publication, engine event delivery, or a true priced thread boundary; its Octane ContextProxy also passes objects by reference.
The actual
benchmarks/lynx-table/web/run-web.mjsworkload tells a different story. It runs production bundles inside a real<lynx-view>backed by Lynx-for-Web and Chromium, drives the same visible table operations through the engine, and compares against vendored ReactLynx and Vue Lynx reference bundles in the same browser session.Before and after collected on 2026-08-10 on the same 18-core Apple M5 Max, using the same pinned reference bundles; medians of three Chromium samples per operation. Reference columns are from the after run, not the earlier session. Absolute times and reference timings drift with browser/host load; deterministic changed-row counts provide the stronger regression evidence.
At 10,000 rows, selecting a row improves from 92 ms to 47 ms; updating every tenth row improves from 132 ms to 93 ms. Selection is now close to the same-run ReactLynx result of 40 ms, but remains slower than Vue Lynx VDOM's 20 ms. Tenth-row updates remain slower than ReactLynx's 70 ms and Vue's 53 ms. Both storms improve by more than half. Mounting changes from 678 ±22 ms to 696 ±12 ms; that small difference overlaps ordinary run variation, so this PR claims no mount improvement.
The mechanism is directly visible in deterministic counters: a 10,000-row selection now executes exactly two
Rowcomponents, while updating every tenth row executes exactly 1,000. Existing wire guards already show that host commands scale with changed rows; this change makes component replay scale with changed rows too.The upstream fork measured precisely this mechanism in Huxpro/octane#11: a 10,000-row selection dropped from 10,000
Rowexecutions to exactly two; updating every tenth row dropped from 10,000 to 1,000. On that fork's different host, real-browser selection improved from 813 ms to 274 ms and the tenth-row update from 888 ms to 473 ms. Those are independent prior results, not claims about this branch; this branch will be judged against its own before/after browser runs.The broader research context is Huxpro/octane#9. Its follow-up Huxpro/octane#21 explicitly stopped speculative code-staged setters and receiver collapse after measuring receiver evaluation at 0.8% of first paint, template expansion at 2.5% of creation, and wire transfer at 1.0% of creation. This change instead addresses the measured owner-replay bottleneck directly.
Changes
this.transport === nullexclusion from the existing full-root retained-subtree eligibility predicate inpackages/octane/src/universal-core.ts.allowRetain, unchanged component identity andObject.is-shallow props, consumed-context invalidation, dirty/visibility/HMR checks, and the existing exclusions for bridges, suspended replay, transitions, regions, portals, and separately scheduled full-root attempts. Do not loosen memo equality, change the compiler, or introduce a new transport ABI.MessageChannelregressions for unchanged keyed-child retention, changed-prop reentry, retained listener delivery after a newer acknowledgement, exactly-once effect mount/cleanup, provider invalidation and later readoption, and keyed reordering without remounting or changing public host identity.benchmarks/lynx-tableprofile build with per-operationRowexecution counts; compile the counter out of shipping and ordinary browser bundles.octaneruntime change.Validation
All affected complete project suites passed 12,531 tests with zero failures: 11,962 Octane development/production plus Three, 320 Lynx, and 249 Rspeedy/Rsbuild/Vite/Rspack plugin tests. The eight affected source, testing, and type-test configurations passed. Repository-wide aggregate commands remain accurately unchecked.
pnpm format:check— repository-wide check not yet run.pnpm typecheck— aggregate typecheck not yet run.pnpm test— aggregate test command not yet run../node_modules/.bin/vitest run --project octane --project octane-prod --project three— 11,962/11,962 tests passed../node_modules/.bin/vitest run --project lynx --reporter=json --outputFile=/private/tmp/octane-lynx-transported-retention-tests.json— 320/320 tests passed across 54 suites and 24 files; zero failed or pending../node_modules/.bin/vitest run --project rspeedy-plugin --project rsbuild-plugin --project vite-plugin --project rspack-plugin— 249/249 integration tests passed../node_modules/.bin/tsgo --noEmit -p packages/octane/tsconfig.json./node_modules/.bin/tsgo --noEmit -p packages/lynx/tsconfig.json./node_modules/.bin/tsgo --noEmit -p packages/lynx/tsconfig.testing.json./node_modules/.bin/tsgo --noEmit -p packages/lynx/typetests/tsconfig.jsonnode benchmarks/bench.mjs --ratios lynx-table— 16/16 guards passed, including all four exact row-render floors and unchanged existing wire/storm guards.node benchmarks/lynx-table/web/run-web.mjs --scales 1000,10000 --reps 3.pnpm sync, scoped Prettier validation,git diff --check, and changeset validation.Risk / follow-ups
@foritem lambda may still allocate descriptors for unchanged items; retained component adoption removes row-body execution, not every parent-loop allocation. Report remaining browser gaps honestly.Provenance
agent-authored)Note
High Risk
Changes universal render retention for async transport commits; incorrect retention could skip updates, break listeners/effects, or desync acknowledgement ordering—mitigated by new transport regressions and deterministic render-breadth gates.
Overview
Transported universal roots can now reuse unchanged keyed component subtrees on ordinary full-root commits by dropping the blanket
transport === nullcheck fromretainEligibleinuniversal-core.ts. Existing guards (unchanged props, context invalidation, dirty/visibility, bridges, transitions, replay) stay in place.New async transport tests cover keyed-child retention, context-driven invalidation, listener delivery after acknowledgement, effect mount/cleanup, and reordering without remounting hosts.
The lynx-table deterministic harness adds profile-only
Rowbody render counts and CI ratio floors (e.g. two rows on select,ceil(rows/10)on tenth-row updates at 1k and 10k) alongside existing wire-command/byte gates.Reviewed by Cursor Bugbot for commit dea29fa. Bugbot is set up for automated code reviews on this repo. Configure here.