Skip to content

perf: omit signal owner runtime from signal-free bundles - #2099

Merged
domgan-oai merged 1 commit into
octanejs:nextfrom
openai-oss-forks:codex/next-signal-owner-reachability
Oct 15, 2026
Merged

domgan-oai merged 1 commit into
octanejs:nextfrom
openai-oss-forks:codex/next-signal-owner-reachability

Conversation

@domgan-oai

@domgan-oai domgan-oai commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

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 passed pnpm typecheck:files; including the test hits existing fixture JSX configuration errors)
  • pnpm test (repo-wide not run locally)
  • targeted tests: 458/458 in development and production across event ownership, root callbacks, direct bindings, hydration identity, opaque handles and signal render frames; deliberate document-only guard made the new test fail. A focused Vitest config reused the Octane project plugin, jsdom and setup because the filtered workspace lacked unrelated root-config dependencies.
  • 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-jsx against the same next base and settings; separate matched Draftboard build.
  • Complete production JavaScript gzip: Threadline Oxc 52,807 → 50,621 B (−2,186), Draftboard Oxc 70,034 → 67,766 B (−2,268), js-framework TSRX 31,360 → 29,061 B (−2,299), JSX 55,033 → 52,935 B (−2,098); Todo, Chat and Weather −2,264, −2,281 and −2,091 B. Feature-retaining suite apps grew 28–66 B Oxc; ceiling +69 B. Esbuild: Threadline and Draftboard each +43 B, Pagecraft +30 B.
  • Paired production-source scoped-signals/run-native-costs.mjs against an immutable, input-verified next archive: 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

  • An agent produced this diff (agent-authored)

Codex task · host com-79386


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with 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/hydrateRoot options 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 “explicit signalOwner may exist” flag. Signal-owner entry points (scopeSignalOwner, instance-key resolution, retry retain/prune/list tracking) early-return on live checks of signalDocumentEnabled and registerRootOptions so 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 after installRootOptions.

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 with signalOwner exposes 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.

@github-actions github-actions Bot added agent-authored Diff or issue body substantially produced by an AI agent perf PR: performance work labels Oct 15, 2026
@domgan-oai
domgan-oai marked this pull request as ready for review October 15, 2026 18:22
@github-actions

Copy link
Copy Markdown
Contributor

Benchmark report

  • 🔴 bundle-size: 40 value(s) increased
  • 🔴 bundle-reachability: 25 value(s) increased

Compares 5370a3161, the merge commit's first parent with 56046c963 on the same runner. Any increase in a js-framework work counter fails this check; byte changes are a report. Wall time is a report: base and head samples alternate in one browser, and an operation is called slower or faster only when the 95% confidence interval of its ratio excludes ±3%. Workflow run

js-framework: 1k/10k row operations

All 20 timed operations (20 without a verdict)
target operation base ms head ms head/base 95% CI
octane-tsrx run 5.917 4.283 −29.5% −55.0% … −1.4% ⚪ within noise
octane-tsrx replace 11.650 11.292 −7.4% −32.5% … +7.9% ⚪ within noise
octane-tsrx add 4.083 3.167 +3.3% −2.7% … +11.4% ⚪ within noise
octane-tsrx update 0.110 0.106 −2.6% −15.6% … +21.1% ⚪ within noise
octane-tsrx select 0.010 0.007 −5.3% −7.7% … −2.5% ⚪ within noise
octane-tsrx swap 0.032 0.030 +2.8% −13.0% … +27.0% ⚪ within noise
octane-tsrx remove 0.024 0.020 −3.0% −20.2% … +0.8% ⚪ within noise
octane-tsrx runlots 32.617 33.933 −1.9% −21.7% … +5.0% ⚪ within noise
octane-tsrx select_lots 0.010 0.013 −2.5% −9.0% … +60.7% ⚪ within noise
octane-tsrx clear 49.542 47.533 −0.3% −7.5% … +2.3% ⚪ within noise
octane-jsx run 4.325 4.742 −1.3% −4.7% … +3.7% ⚪ within noise
octane-jsx replace 8.617 7.150 −2.5% −8.7% … +0.7% ⚪ within noise
octane-jsx add 5.475 3.983 −2.3% −31.1% … +7.9% ⚪ within noise
octane-jsx update 0.225 0.238 −2.3% −9.3% … +10.3% ⚪ within noise
octane-jsx select 0.148 0.156 +4.2% −12.6% … +31.9% ⚪ within noise
octane-jsx swap 0.203 0.196 −4.3% −25.4% … +2.6% ⚪ within noise
octane-jsx remove 0.204 0.208 +2.6% −2.4% … +6.7% ⚪ within noise
octane-jsx runlots 36.508 36.425 −0.2% −3.4% … +3.1% ⚪ within noise
octane-jsx select_lots 1.322 1.136 −1.7% −17.7% … +12.9% ⚪ within noise
octane-jsx clear 58.117 58.308 −3.3% −7.6% … +6.6% ⚪ within noise

All 64 work counters are unchanged.

Application bundle size (bytes)

target metric base head Δ
octane-tsrx js_raw 93,565 86,247 −7,318 (−7.8%) 🟢
octane-tsrx js_gzip 31,333 29,077 −2,256 (−7.2%) 🟢
octane-tsrx js_brotli 28,287 26,217 −2,070 (−7.3%) 🟢
octane-tsrx app_gzip 2,617 2,615 −2 (−0.1%) 🟢
octane-tsrx app_brotli 2,268 2,265 −3 (−0.1%) 🟢
octane-tsrx fw_raw 86,009 78,691 −7,318 (−8.5%) 🟢
octane-tsrx fw_gzip 28,716 26,462 −2,254 (−7.8%) 🟢
octane-tsrx fw_brotli 26,019 23,952 −2,067 (−7.9%) 🟢
octane-tsrx todo_js_raw 106,404 99,081 −7,323 (−6.9%) 🟢
octane-tsrx todo_js_gzip 35,995 33,733 −2,262 (−6.3%) 🟢
octane-tsrx todo_js_brotli 32,203 30,170 −2,033 (−6.3%) 🟢
octane-tsrx todo_app_gzip 2,779 2,780 +1 (+0.0%) 🔴
octane-tsrx todo_app_brotli 2,336 2,335 −1 (−0.0%) 🟢
octane-tsrx todo_fw_raw 100,163 92,840 −7,323 (−7.3%) 🟢
octane-tsrx todo_fw_gzip 33,216 30,953 −2,263 (−6.8%) 🟢
octane-tsrx todo_fw_brotli 29,867 27,835 −2,032 (−6.8%) 🟢
octane-tsrx chat_js_raw 105,255 97,934 −7,321 (−7.0%) 🟢
octane-tsrx chat_js_gzip 35,732 33,466 −2,266 (−6.3%) 🟢
octane-tsrx chat_js_brotli 32,031 30,092 −1,939 (−6.1%) 🟢
octane-tsrx chat_app_gzip 3,210 3,211 +1 (+0.0%) 🔴
octane-tsrx chat_app_brotli 2,797 2,803 +6 (+0.2%) 🔴
octane-tsrx chat_fw_raw 98,114 90,793 −7,321 (−7.5%) 🟢
octane-tsrx chat_fw_gzip 32,522 30,255 −2,267 (−7.0%) 🟢
octane-tsrx chat_fw_brotli 29,234 27,289 −1,945 (−6.7%) 🟢
octane-tsrx weather_js_raw 143,023 136,341 −6,682 (−4.7%) 🟢
octane-tsrx weather_js_gzip 47,339 45,263 −2,076 (−4.4%) 🟢
octane-tsrx weather_js_brotli 42,040 40,223 −1,817 (−4.3%) 🟢
octane-tsrx weather_app_brotli 7,329 7,327 −2 (−0.0%) 🟢
octane-tsrx weather_fw_raw 117,936 111,254 −6,682 (−5.7%) 🟢
octane-tsrx weather_fw_gzip 38,715 36,639 −2,076 (−5.4%) 🟢
octane-tsrx weather_fw_brotli 34,711 32,896 −1,815 (−5.2%) 🟢
octane-tsrx bindings_js_raw 685,281 685,343 +62 (+0.0%) 🔴
octane-tsrx bindings_js_gzip 226,456 226,469 +13 (+0.0%) 🔴
octane-tsrx bindings_js_brotli 192,857 192,856 −1 (−0.0%) 🟢
octane-tsrx bindings_app_gzip 116,965 116,967 +2 (+0.0%) 🔴
octane-tsrx bindings_app_brotli 97,156 97,056 −100 (−0.1%) 🟢
octane-tsrx bindings_fw_raw 331,099 331,161 +62 (+0.0%) 🔴
octane-tsrx bindings_fw_gzip 109,491 109,502 +11 (+0.0%) 🔴
octane-tsrx bindings_fw_brotli 95,701 95,800 +99 (+0.1%) 🔴
octane-tsrx wayfinder_js_raw 438,267 438,372 +105 (+0.0%) 🔴
octane-tsrx wayfinder_js_gzip 144,544 144,613 +69 (+0.0%) 🔴
octane-tsrx wayfinder_js_brotli 126,167 126,240 +73 (+0.1%) 🔴
octane-tsrx threadline_oxc_js_raw 160,616 153,810 −6,806 (−4.2%) 🟢
octane-tsrx threadline_oxc_js_gzip 52,860 50,737 −2,123 (−4.0%) 🟢
octane-tsrx threadline_oxc_js_brotli 46,455 44,741 −1,714 (−3.7%) 🟢
octane-tsrx threadline_esbuild_js_raw 178,635 178,741 +106 (+0.1%) 🔴
octane-tsrx threadline_esbuild_js_gzip 59,796 59,857 +61 (+0.1%) 🔴
octane-tsrx threadline_esbuild_js_brotli 52,629 52,710 +81 (+0.2%) 🔴
octane-tsrx pagecraft_oxc_js_raw 544,561 544,622 +61 (+0.0%) 🔴
octane-tsrx pagecraft_oxc_js_gzip 171,281 171,303 +22 (+0.0%) 🔴
octane-tsrx pagecraft_oxc_js_brotli 145,353 145,474 +121 (+0.1%) 🔴
octane-tsrx pagecraft_esbuild_js_raw 577,018 577,124 +106 (+0.0%) 🔴
octane-tsrx pagecraft_esbuild_js_gzip 186,569 186,609 +40 (+0.0%) 🔴
octane-tsrx pagecraft_esbuild_js_brotli 158,588 158,618 +30 (+0.0%) 🔴
octane-tsrx full_fw_raw 522,733 522,834 +101 (+0.0%) 🔴
octane-tsrx full_fw_gzip 163,178 163,241 +63 (+0.0%) 🔴
octane-tsrx full_fw_brotli 138,796 138,924 +128 (+0.1%) 🔴
octane-jsx js_raw 169,120 162,445 −6,675 (−3.9%) 🟢
octane-jsx js_gzip 55,100 52,995 −2,105 (−3.8%) 🟢
octane-jsx js_brotli 48,603 46,780 −1,823 (−3.8%) 🟢
octane-jsx app_brotli 2,889 2,890 +1 (+0.0%) 🔴
octane-jsx fw_raw 158,061 151,386 −6,675 (−4.2%) 🟢
octane-jsx fw_gzip 51,519 49,414 −2,105 (−4.1%) 🟢
octane-jsx fw_brotli 45,714 43,890 −1,824 (−4.0%) 🟢
octane-jsx shell_js_raw 327,113 327,220 +107 (+0.0%) 🔴
octane-jsx shell_js_gzip 106,589 106,622 +33 (+0.0%) 🔴
octane-jsx shell_js_brotli 92,500 92,579 +79 (+0.1%) 🔴
octane-jsx shell_app_brotli 656 655 −1 (−0.2%) 🟢
octane-jsx shell_fw_raw 326,020 326,127 +107 (+0.0%) 🔴
octane-jsx shell_fw_gzip 105,828 105,861 +33 (+0.0%) 🔴
octane-jsx shell_fw_brotli 91,844 91,924 +80 (+0.1%) 🔴
octane-jsx shell_client_js_raw 278,558 278,618 +60 (+0.0%) 🔴
octane-jsx shell_client_js_gzip 90,186 90,227 +41 (+0.0%) 🔴
octane-jsx shell_client_js_brotli 78,867 78,885 +18 (+0.0%) 🔴
octane-jsx shell_client_app_gzip 773 769 −4 (−0.5%) 🟢
octane-jsx shell_client_app_brotli 669 663 −6 (−0.9%) 🟢
octane-jsx shell_client_fw_raw 277,457 277,517 +60 (+0.0%) 🔴
octane-jsx shell_client_fw_gzip 89,413 89,458 +45 (+0.1%) 🔴
octane-jsx shell_client_fw_brotli 78,198 78,222 +24 (+0.0%) 🔴
octane-jsx full_fw_raw 522,733 522,834 +101 (+0.0%) 🔴
octane-jsx full_fw_gzip 163,178 163,241 +63 (+0.0%) 🔴
octane-jsx full_fw_brotli 138,796 138,924 +128 (+0.1%) 🔴

11 other measured values are unchanged.

Public-import reachability bundles (bytes)

target metric base head Δ
cli-spa-starter raw 85,850 78,533 −7,317 (−8.5%) 🟢
cli-spa-starter gzip 29,525 27,208 −2,317 (−7.8%) 🟢
cli-spa-starter brotli 26,430 24,411 −2,019 (−7.6%) 🟢
root-static-specialized raw 57,141 50,818 −6,323 (−11.1%) 🟢
root-static-specialized gzip 19,381 17,418 −1,963 (−10.1%) 🟢
root-static-specialized brotli 17,642 15,842 −1,800 (−10.2%) 🟢
root-chained-jsx raw 59,282 52,961 −6,321 (−10.7%) 🟢
root-chained-jsx gzip 20,097 18,114 −1,983 (−9.9%) 🟢
root-chained-jsx brotli 18,313 16,493 −1,820 (−9.9%) 🟢
root-static raw 144,698 138,031 −6,667 (−4.6%) 🟢
root-static gzip 47,262 45,206 −2,056 (−4.4%) 🟢
root-static brotli 42,074 40,247 −1,827 (−4.3%) 🟢
root-static-local raw 57,040 50,719 −6,321 (−11.1%) 🟢
root-static-local gzip 19,335 17,368 −1,967 (−10.2%) 🟢
root-static-local brotli 17,607 15,813 −1,794 (−10.2%) 🟢
root-callback-local raw 59,700 53,378 −6,322 (−10.6%) 🟢
root-callback-local gzip 20,180 18,214 −1,966 (−9.7%) 🟢
root-callback-local brotli 18,362 16,584 −1,778 (−9.7%) 🟢
hooks-state raw 68,052 61,728 −6,324 (−9.3%) 🟢
hooks-state gzip 23,027 21,041 −1,986 (−8.6%) 🟢
hooks-state brotli 20,913 19,125 −1,788 (−8.5%) 🟢
prop-attributes raw 65,155 58,834 −6,321 (−9.7%) 🟢
prop-attributes gzip 22,148 20,172 −1,976 (−8.9%) 🟢
prop-attributes brotli 20,224 18,363 −1,861 (−9.2%) 🟢
context raw 75,147 69,517 −5,630 (−7.5%) 🟢
context gzip 25,196 23,357 −1,839 (−7.3%) 🟢
context brotli 22,786 21,175 −1,611 (−7.1%) 🟢
hydrate-root raw 96,114 96,176 +62 (+0.1%) 🔴
hydrate-root gzip 32,328 32,358 +30 (+0.1%) 🔴
hydrate-root brotli 28,834 28,868 +34 (+0.1%) 🔴
deferred-hydration raw 180,118 180,180 +62 (+0.0%) 🔴
deferred-hydration gzip 58,700 58,748 +48 (+0.1%) 🔴
deferred-hydration brotli 51,291 51,330 +39 (+0.1%) 🔴
hydrate-frame raw 340,353 340,460 +107 (+0.0%) 🔴
hydrate-frame gzip 109,246 109,305 +59 (+0.1%) 🔴
hydrate-frame brotli 94,858 94,928 +70 (+0.1%) 🔴
suspense-transition raw 119,986 115,336 −4,650 (−3.9%) 🟢
suspense-transition gzip 39,214 37,715 −1,499 (−3.8%) 🟢
suspense-transition brotli 34,862 33,555 −1,307 (−3.7%) 🟢
component-owned-effects raw 61,227 54,907 −6,320 (−10.3%) 🟢
component-owned-effects gzip 20,722 18,738 −1,984 (−9.6%) 🟢
component-owned-effects brotli 18,872 17,081 −1,791 (−9.5%) 🟢
descriptor-children raw 166,432 159,767 −6,665 (−4.0%) 🟢
descriptor-children gzip 54,004 51,894 −2,110 (−3.9%) 🟢
descriptor-children brotli 47,999 46,173 −1,826 (−3.8%) 🟢
binding-hooks raw 70,453 64,127 −6,326 (−9.0%) 🟢
binding-hooks gzip 24,047 22,034 −2,013 (−8.4%) 🟢
binding-hooks brotli 21,806 20,020 −1,786 (−8.2%) 🟢
split-shell raw 391,235 391,337 +102 (+0.0%) 🔴
split-shell gzip 127,365 127,432 +67 (+0.1%) 🔴
split-shell brotli 111,020 110,999 −21 (−0.0%) 🟢
split-shell-runtime raw 316,020 316,122 +102 (+0.0%) 🔴
split-shell-runtime gzip 101,596 101,657 +61 (+0.1%) 🔴
split-shell-runtime brotli 87,819 87,801 −18 (−0.0%) 🟢
binding-base-ui-vite raw 176,955 170,277 −6,678 (−3.8%) 🟢
binding-base-ui-vite gzip 57,602 55,517 −2,085 (−3.6%) 🟢
binding-base-ui-vite brotli 51,063 49,322 −1,741 (−3.4%) 🟢
binding-base-ui-esbuild raw 198,369 198,475 +106 (+0.1%) 🔴
binding-base-ui-esbuild gzip 66,596 66,654 +58 (+0.1%) 🔴
binding-base-ui-esbuild brotli 58,895 58,933 +38 (+0.1%) 🔴
binding-radix-vite raw 176,391 169,721 −6,670 (−3.8%) 🟢
binding-radix-vite gzip 57,263 55,199 −2,064 (−3.6%) 🟢
binding-radix-vite brotli 50,749 48,991 −1,758 (−3.5%) 🟢
binding-radix-esbuild raw 197,857 197,963 +106 (+0.1%) 🔴
binding-radix-esbuild gzip 66,299 66,332 +33 (+0.0%) 🔴
binding-radix-esbuild brotli 58,612 58,606 −6 (−0.0%) 🟢
binding-mantine-hooks-vite raw 68,743 63,066 −5,677 (−8.3%) 🟢
binding-mantine-hooks-vite gzip 23,485 21,678 −1,807 (−7.7%) 🟢
binding-mantine-hooks-vite brotli 21,326 19,726 −1,600 (−7.5%) 🟢
binding-mantine-hooks-esbuild raw 77,574 77,656 +82 (+0.1%) 🔴
binding-mantine-hooks-esbuild gzip 27,501 27,525 +24 (+0.1%) 🔴
binding-mantine-hooks-esbuild brotli 24,883 24,835 −48 (−0.2%) 🟢
binding-apollo-client-vite raw 321,565 314,930 −6,635 (−2.1%) 🟢
binding-apollo-client-vite gzip 100,573 98,432 −2,141 (−2.1%) 🟢
binding-apollo-client-vite brotli 88,889 87,089 −1,800 (−2.0%) 🟢
binding-apollo-client-esbuild raw 350,228 350,334 +106 (+0.0%) 🔴
binding-apollo-client-esbuild gzip 113,572 113,627 +55 (+0.0%) 🔴
binding-apollo-client-esbuild brotli 100,261 100,215 −46 (−0.0%) 🟢
binding-usehooks-ts-vite raw 69,525 63,848 −5,677 (−8.2%) 🟢
binding-usehooks-ts-vite gzip 23,745 21,916 −1,829 (−7.7%) 🟢
binding-usehooks-ts-vite brotli 21,553 19,907 −1,646 (−7.6%) 🟢
binding-usehooks-ts-esbuild raw 78,342 78,424 +82 (+0.1%) 🔴
binding-usehooks-ts-esbuild gzip 27,742 27,768 +26 (+0.1%) 🔴
binding-usehooks-ts-esbuild brotli 25,071 25,121 +50 (+0.2%) 🔴

39 other measured values are unchanged.

@domgan-oai
domgan-oai merged commit 3d0fb03 into octanejs:next Oct 15, 2026
54 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agent-authored Diff or issue body substantially produced by an AI agent perf PR: performance work

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant