Repository navigation
perf(lynx): minimize universal keyed moves - #716
Merged
Merged
Conversation
1 task done
trueadm
marked this pull request as ready for review
August 12, 2026 09:01
4 of 5 tasks
trueadm
added a commit
that referenced
this pull request
Oct 3, 2026
… to renderers that use them (#1652) * perf(octane): ship universal host bindings and template programs only to renderers that use them Weekly Bench's three-bundle-size guards breached at 1.059x (minimal) and 1.042x (full catalogue) of React Three Fiber. Since #677, octane-min grew 15.6 KB gzip, almost all of it in universal-core.ts (131 KB -> 178 KB minified). The largest additions were Lynx-only template paths (#693, #700, #716, #750) and opt-in host bindings (#1044). @octanejs/three itself was flat. - universalHostBinding() now installs the subscription, flush, and binding-only transaction code on its first call. The root keeps one lazy binding state instead of seven eager fields, and commits skip the per-host binding loops when no binding can exist. - Template programs are a driver opt-in: templateProgramMount, templateProgramRuns, and collapsedTemplateMount take effect only with `templates: universalHostTemplates`. The Lynx background driver passes it. Program preparation, collapsed-template materialization and expansion, and the compact template update now sit behind that object. octane-min 199019 -> 193811 gzip (1.031x), octane-full 260746 -> 255569 (1.021x). The guards ratchet to 1.034 and 1.024; reaching 1.0 needs a broader universal-core diet. Co-Authored-By: Claude Opus 5.5 <[email protected]> * chore: split the Lynx changeset from the octane changeset The changeset check rejects a changeset that mixes the ignored private @octanejs/lynx package with octane. Co-Authored-By: Claude Opus 5.5 <[email protected]> --------- Co-authored-by: Claude Opus 5.5 <[email protected]>
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
Tracks Huxpro#46.
Recalibration
This branch is based on upstream
mainatffadd397, after #706 and #707 merged. The full live experiment was also run on an integration stack containing the complete #706 head followed by both #707 commits before those PRs merged.Results
The 1,000-row far swap drops from 997 universal move commands / 47,986 bytes to 2 moves / 368 bytes, with zero row re-renders and preserved DOM identity and event routing. The same two-move invariant holds at 10k and 30k rows.
Create, replace, append, and clear stayed within the accepted v1 regression envelope in both orders. The rejected reverse-placement prototype regressed append/replace by 20–32%; the submitted forward placement anchors to the next stable survivor and avoids that regression.
Latest-main rows=0 bundle deltas:
Validation
pnpm vitest run packages/octane/tests/universal-event-scope.test.ts packages/octane/tests/universal-host-sdk.test.ts packages/octane/tests/universal-renderer.test.ts packages/octane/tests/universal-core.test.ts— 106 passedpnpm exec tsgo --noEmit -p packages/octane/tsconfig.jsonnode benchmarks/bench.mjs --only lynx-table --ratios— 24/299 applicable guards passedpnpm format:files:check ...pnpm syncProvenance
Note
Medium Risk
Touches core universal keyed reconciliation and host placement, so incorrect LIS planning could break survivor identity, events, or append/replace template coalescing. Coverage and deterministic swap gates mitigate that risk.
Overview
Minimizes keyed host moves by replacing the greedy placement planner with an O(n log n) longest-increasing-subsequence plan in
universal-core. Distant swaps now move only unstable survivors (e.g. 2 moves instead of ~997) while preserving identity, events, and lifecycle.Stable survivors stay put; inserts/moves anchor to the next stable host. LIS runs only when survivors are actually reordered, so append/replace still coalesce into one
mount-template-run.Adds lynx-table swap gates for wire bytes, zero row re-renders, and handle deltas at 1k/10k, plus unit coverage for distant swaps and append/replace template runs.
Reviewed by Cursor Bugbot for commit 50ddc5c. Bugbot is set up for automated code reviews on this repo. Configure here.