Repository navigation
perf: avoid signal ownership and Action code in ordinary roots - #1135
Merged
domgan-oai merged 4 commits intoSep 18, 2026
Merged
domgan-oai merged 4 commits into
domgan-oai merged 4 commits into
Conversation
domgan-oai
marked this pull request as ready for review
September 18, 2026 21:06
…rf-signal-free-runtime-1130
…rf-signal-free-runtime-1130
This was referenced Sep 18, 2026
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
An opaque scalar prop could enable document-wide signal ownership, and every ordinary root retained the concrete signal Action implementation through function-form Actions. Defer ownership until a real handle appears, preserve primitive value proofs through extracted JSX props, and register model Action frames from the signal graph instead of importing their constructor into the renderer.
Refs #1118 and #1130 §2.1. This recovers a measured part of the unused-signals regression; it does not close either issue or restore the entire pre-#1069 bundle size.
Changes
Size evidence and tradeoff
After the key and scoped-stylesheet fixes landed, matched ordinary production builds use exact Git archives of
main @ 9b22cffdand candidate39e8e7b9, identical fixture/package/lock hashes, Node 24.19, Vite 8.1.5 and esbuild 0.28.1. The subsequent website-only main advance leaves Octane source and tests byte-identical. Whole gzip closures:Both Action implementation modules emit zero bytes in an ordinary esbuild
createRootclosure; optional native adapters and graph dependencies remain excluded. The production opaque-row guard preserves scalar text/title updates, keyed identity, typed input and teardown while owner freezes and identity serialization drop to zero. It fails on original main with 201 owner allocations. The source-preserving 2,000-row/20-update audit also removes 160,040 measured owner-map reads during updates.Separate matched engine/SSR/combined-native builds against
main @ 1d935515cshow the tradeoff. The model implementation is moved, not made free: a standalone Vite engine closure grows 11,457 → 14,654 gzip (+3,197, +27.9%), and a representative compiled SSR+engine fixture grows 27,970 → 30,785 (+2,815, +10.1%). Neither reaches the native forwarding module. A combined native renderer+engine app is nearly unchanged: 91,656 → 91,800 (+144, +0.16%), with real urgent and transition updates, survivor identity and cleanup verified. These are separately built closures; compressed totals are not summed. No SSR CPU improvement is claimed.Validation
pnpm syncand diff checks passed. Existing compiler-test@tsrx/coreTS7016 is reproduced on original main; no declarations or type rules are weakened. Full repository tests/typecheck are delegated to current-head CI.Risk / follow-ups
The standalone signals/SSR parse-load increase is material and explicit. Avoiding the implementation in both independent engine and renderer closures requires a further capability/loading architecture; async initialization or import-name gating would change supported behavior. Remaining renderer signal branches and SSR ownership costs are outside this patch, so the full reported 21% regression is not described as fixed.
Provenance
agent-authored)Need help on this PR? Tag
@codesmith-botwith what you need. Autofix is disabled.Note
Medium Risk
Touches compiler binding classification, transition/Action wiring, and bundle boundaries; behavior is heavily tested but incorrect primitive vs opaque classification could break signal adoption or leave stale DOM on updates.
Overview
Signal-free roots stay leaner by not turning on document-wide signal ownership or pulling transition Action code unless a binding is actually a signal handle. Opaque props can still use signal-capable paths later without paying that cost up front.
The compiler now tracks primitive value proofs on extracted JSX holes (
octane_primitive_value), so expressions likeString(props.x)skipbindSignal*codegen and eagerenableSignalBindings, while casts, bare props, and uncertain branches stay signal-capable. Eager activation is limited to direct handle expressions (inputs, children, host spreads).Runtime packaging splits the model
SignalActionFrameintotransition-action.ts, registered from the signal graph viaregisterSignalActionFrameFactory. OrdinarycreateRootbundles can tree-shaketransition-action/ heavy candidate logic; native presentation installs viainstallNativeSignalActionExtensionwhen the native read driver starts. Lateoctane/signalsimport during a pending Action still gets a frame from the factory.Guards extend minimal bundle reachability, scoped-signal boundaries (zero emitted bytes for transition modules on signal-free clients), allocation tests for scalar list rows, primitive codegen matrix, hydration adoption, and Action lifecycle (urgent updates, form actions, forwarded handles).
Reviewed by Cursor Bugbot for commit 572b83b. Bugbot is set up for automated code reviews on this repo. Configure here.