Repository navigation
perf: omit control writers from ordinary text and attribute bindings - #1141
Merged
domgan-oai merged 3 commits intoSep 19, 2026
Merged
domgan-oai merged 3 commits into
domgan-oai merged 3 commits into
Conversation
domgan-oai
marked this pull request as ready for review
September 19, 2026 00:20
3 of 6 tasks
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
A normal compiled text or attribute binding retains the shared value/checked writer and control-adoption machinery even when the application does not use signals or form controls. Split the shared writer policies so the bundler can omit those unselected control paths. Text/attribute subscriptions and cleanup remain shared; the public compiler-helper ABI stays unchanged.
Each binding replaces its existing kind field with a shared policy reference, without a new per-binding allocation. Scalar writers preserve their cache tokens, and bound text retains its adopted Text node across documents. Value/checked policies retain native edits, hydration adoption, pending retries and controlled textarea behavior.
Refs #1130 (section 2.1), #1118. This is a partial correction of the unused-signals size regression.
Matched production bundles
Fresh upstream
330bb087, the same authored fixtures, lockfile, Node 24.19.0, esbuild 0.28.1 and Vite 8.1.5 were used for both candidates. All 22 final public bundles reproduce identical hashes and sizes on a repeat build.The compiled plain/control benchmark changes from 80,959/81,321 gzip bytes to 79,770/81,446. It executes both bundled consumers and checks live updates, host/Text identity, native control values and teardown; the original runtime fails the deletion guard.
Validation
tsgo, scoped file types, scoped formatting, changeset checks andgit diff --check.pnpm syncleaves no generated changes.pnpm format:check(repo-wide CI)pnpm typecheck(repo-wide CI)pnpm test(repo-wide CI)Local validation was scoped. All 26 jobs in previous-head CI passed at
2826abbeafter one same-head failed-job rerun. The initial WebKit fetched-history case timed out at its cached-revision locator; the exact local production case and the unchanged-head CI rerun passed. No source workaround or test relaxation was made; a root cause for that transient failure is not established. Bugbot passed with no actionable threads. Superseded draft checks are not counted as validation.Risk / follow-ups
Writer dispatch gains one shared-policy indirection. A matched 2,000-row, 80-update workload with 10 warmups and 30 alternating pairs preserves output, identity and drained cleanup. Live update ratio median was 1.031 with IQR 0.903–1.118; no speed improvement or consistent timing regression is established. Browser layout/paint and broad application performance were not measured.
The fully used control client costs 133 gzip bytes, while engine/SSR remain byte-identical. The original pre-#1069 unused-signals regression remains open; this PR does not claim full recovery.
Main integration (2026-09-19)
Merged current main
873f4d2049without rewriting published history. Signed two-parent merge head:fdec76b6be. Retains the landed context API removal, same-file root/hydration specialization and native transition extraction.Local merge validation: 372 public development/production results, 111 signal binding/hydration results across development, production and Strong, 88 development/production transition results, and 22 bundle guards passed; effective scoped types, formatting and final sync passed. The initial concurrent run timed out only the cold-module hydration case; both instances and the complete serial repeat pass with the unchanged five-second timeout. No timeout or assertion was changed.
Full previous-integration CI passed all 26 jobs; Bugbot succeeded with no unresolved review threads.
The first main-integration run failed the TanStack Query SSR error case with a missing QueryClient context before client hydration. The owning server/compiler inputs match main, the exact case passed on main, and the unchanged focused three-case suite passes locally. One failed-job rerun was used without changing source, assertions or timeouts; the initial cause is not established.
Main refresh (2026-09-19, second pass)
Merged current main
68a669007bwithout rewriting published history. Signed two-parent merge head:9f7cfcdabc. Preserves the landed scalar style, imported/local root and native-event authority changes alongside this PR's writer policies. The sole manual conflict was in the shared bundle guards; main's complete file and this PR's complete writer-control test are both retained.Local refresh validation: 588 public development/production results covering bindings, hydration, event ownership, transitions and local roots; 165 signal binding/hydration/action results across development, production and Strong; and 23 bundle guards passed. Scoped types, formatting and final sync passed. No source workaround, bundle cap, assertion or test timeout was changed.
The initial refresh run failed the TanStack Query SSR error case with a missing QueryClient context before client hydration. The owning server/compiler/fixture inputs match current main, where the exact case passes, and the unchanged focused three-case suite passes locally with the default timeout. One unchanged-head failed-job rerun was used. No source, assertion or timeout change was made; the initial cause remains unconfirmed.
Full current-head CI passed all 26 jobs; Bugbot succeeded with no unresolved review threads. The PR is open and ready for human review.
Provenance
agent-authored)Need help on this PR? Tag
@codesmith-botwith what you need. Autofix is disabled.Note
Medium Risk
Touches the hot direct-signal binding path in
runtime.ts, but behavior is heavily regression-tested; writer dispatch adds one policy indirection with no intended semantic change.Overview
Splits direct signal binding dispatch into shared policy objects so text and attribute bindings no longer pull form-control writers and hydration adoption into production bundles, while value/checked bindings keep the full control path.
Bindings now reference a
DirectSignalBindingPolicy(withwriteBinding,write, and optionalcontrol) instead of a barekindstring. Scalar caches, subscriptions, and the publicbindSignal*compiler helpers stay the same; writer logic is factored into dedicated helpers likewriteDirectSignalAttributeandwriteDirectSignalText.A bundle-boundaries test compares gzip size and live DOM behavior for plain text/attribute-only apps vs apps with inputs/checkbox/select/textarea. Hydration tests cover mixed channels (dev/prod, tsx/tsrx, strong, hydrate) and cross-document adopted text nodes.
Reviewed by Cursor Bugbot for commit fdec76b. Bugbot is set up for automated code reviews on this repo. Configure here.