Repository navigation
perf: omit signal owner runtime from signal-free bundles - #2099
Merged
domgan-oai merged 1 commit intoOct 15, 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
October 15, 2026 18:22
Contributor
Benchmark report
Compares js-framework: 1k/10k row operationsAll 20 timed operations (20 without a verdict)
All 64 work counters are unchanged. Application bundle size (bytes)
11 other measured values are unchanged. Public-import reachability bundles (bytes)
39 other measured values are unchanged. |
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
Signal-free applications were retaining the renderer's signal-owner identity and retry machinery through general rendering, event and list paths. Reuse the existing options-capable root registration as the conservative explicit-owner capability, alongside the live signal-document capability, so Oxc can remove that machinery when neither feature can exist. Keep recursive retry references inside their function bindings so dead walks can disappear with their callers.
The capability only says that an explicit owner is possible; it never grants an owner. The existing root and scope state still determines authority. The benchmark now checks both signal-free removal and signal-enabled retention, and a native-event test protects explicit ownership and root isolation.
Validation
pnpm format:check(repo-wide not run; changed-file formatting passed)pnpm typecheck(repo-wide not run; four changed runtime files passedpnpm typecheck:files; including the test hits existing fixture JSX configuration errors)pnpm test(repo-wide not run locally)node benchmarks/bundle-size/run-minimal.mjs context hydrate-frame(negative and positive source-map controls);node benchmarks/bundle-size/run.mjs octane-tsrx octane-jsxagainst the samenextbase and settings; separate matched Draftboard build.scoped-signals/run-native-costs.mjsagainst an immutable, input-verifiednextarchive: 2 warmups, 15 alternating samples, 5,000 updates and 128 mounts per sample. All semantic/identity/teardown controls and deterministic work matched. Signal-reading update means were 0.921→0.879, 2.504→2.466, 1.293→1.099 and 3.011→2.780 µs; paired intervals included no change. Happy DOM measures synchronous renderer work, not browser layout or paint. One unread control unmount measured 1.516→1.622 µs (paired +6.2%, 95% interval +1.2% to +11.4%); the earlier smaller run was inconclusive.perf-review: scan found 0 candidates. Owner resolution is per component/event, retry tracking per list/retry, and root registration once per root. No hot-record shape, per-operation allocation, DOM, scheduling or compiler-output changes; the added live branches remain only in feature-capable bundles. Current-head CI benchmark: all 64 production work counters unchanged; all 20 paired browser timings had no verdict beyond ±3%. CI complete-bundle gzip: Threadline Oxc −2,123 B, js-framework TSRX −2,256 B, JSX −2,105 B, feature-retaining apps +13–69 B, Threadline esbuild +61 B.concise-code: runtime source +35/−20; no new runtime file, public API, flag or record field. Reused the existing root registration instead of adding a parallel capability; a shared guard helper prevented Oxc folding, and guarding only document activation broke explicit root ownership. One changeset records the package improvement.pnpm sync(no generated diff).Risk / follow-ups
The optimization depends on Oxc seeing the live capability checks directly; esbuild retains the code and has the small growth above. Source-map declaration controls will need updating if the owner implementation is reorganized. Timing uncertainty and the unread-control unmount result are reported above; The CI browser comparison found no timing verdict beyond ±3% and no added production work.
Provenance
agent-authored)Codex task · host
com-79386Need help on this PR? Tag
@codesmith-botwith what you need.Note
Medium Risk
Changes renderer signal-owner and retry paths behind capability guards that must remain visible to the minifier; mis-folded guards could break explicit root ownership or hydration, though benchmarks and a new isolation test cover the main cases.
Overview
Signal-owner identity and retry machinery can now be dropped from production bundles when an app never enables the signal-document capability and only uses compiler default-options roots (no
createRoot/hydrateRootoptions ABI).Root error-handler installation is generalized to
registerRootOptions/installRootOptions: the nullable slot stays unset for default-options-only entry points and doubles as the “explicitsignalOwnermay exist” flag. Signal-owner entry points (scopeSignalOwner, instance-key resolution, retry retain/prune/list tracking) early-return on live checks ofsignalDocumentEnabledandregisterRootOptionsso Oxc can eliminate the unused graph; recursive retry helpers are named function expressions so dead walks can go away with their callers. Engine/roots call registration only when the installer is present; hydrate paths use non-null assertion afterinstallRootOptions.Bundle reachability controls were extended to assert signal-owner declarations are dropped in signal-free scenarios (e.g.
context) and retained when hydration/signal features need them (hydrate-frame). A test confirms a root withsignalOwnerexposes that owner in native handlers while a plain root does not.Reviewed by Cursor Bugbot for commit 2428b40. Bugbot is set up for automated code reviews on this repo. Configure here.