Skip to content

perf(octane): bind the host descriptor renderer's entry points separately - #2255

Merged
trueadm merged 2 commits into
mainfrom
perf/host-descriptor-driver-bindings
Oct 28, 2026
Merged

trueadm merged 2 commits into
mainfrom
perf/host-descriptor-driver-bindings

Conversation

@jonkwheeler

@jonkwheeler jonkwheeler commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

Summary

A size follow-up to #2249. The host element descriptor renderer's seven entry points become separate module bindings instead of fields of one HOST_DESCRIPTORS object. Bundles that install the renderer reach all seven, and a minifier can shorten a binding's name but not a property's. Bundles that never install the renderer still drop it.

Why

#2249 shrank .tsrx apps that never build host descriptors by 2.4–3.7 KB gzip. It grew apps that do build them, such as JSX apps and bindings, by up to 216 gzip bytes. Its #1921 entry has no automated review: every entry since 2026-10-21 reads "No Claude review: add an ANTHROPIC_API_KEY repository secret…". So I diffed an unminified benchmarks/js-framework/octane-jsx build at fcb0224 against one at 10b10ad. The 370 raw bytes JSX apps gained come from three places:

  1. The driver object: seven property names (reconcile, body, adopts, landPair, unchanged, adoptQueue, placeUpgraded) in its literal, and about 14 hostDriver.x reads at call sites. A minifier keeps every property name in full.
  2. Host and non-host dispatch at the two deopt child loops (isHostDescriptor(child) ? reconcileDeoptHost(…) : reconcileDeoptNode(…)).
  3. applyDeoptText split out of applyDeoptOrder, with queueDeoptOrder taking the apply function.

Items 2 and 3 are what lets a bundle without host descriptors drop the renderer, so this PR leaves them alone. It changes item 1 only.

Changes

  • runtime/drivers.ts: HOST_BODY, HOST_RECONCILE, HOST_ADOPTS, HOST_LAND_PAIR, HOST_UNCHANGED, HOST_ADOPT_QUEUE and HOST_PLACE_UPGRADED replace the HostDescriptorDriver object. enableHostDescriptors sets all seven together. HOST_BODY is set exactly when the renderer is installed, so it serves as the installed check. An early return keeps repeat installs from the public factories, which install on every call, to one check, as ??= did.
  • runtime/child-slots.ts, runtime/deopt.ts: the captured hostDriver local becomes hostBody, which keeps the same X ? X : null shape, and calls read the bindings. Every call is guarded by hostBody !== null or by its own binding (HOST_ADOPT_QUEUE && …), so the guards still fold away in a bundle that never installs the renderer.
  • runtime/elements.ts: the install guards check HOST_BODY.
  • A patch changeset for octane.

No behavior change.

Size

From this PR's benchmark report (base d44d6d9):

  • raw: −99 bytes in every bundle that installs the renderer, and −3 in bundles that drop it.
  • gzip: −35 to −80 in bundles that install the renderer, for example octane-jsx js −42, descriptor-children −80, full_fw −75, bindings_js −35 and split-shell −44. Bundles that drop it move between −14 and +13.
  • brotli: mixed. Some bundles shrink (octane-jsx js −140, split-shell −117, hydrate-frame −99) and some grow (pagecraft_oxc +149, bindings_js +121, full_fw +109). Bundles that drop the renderer also move by up to +71 brotli on a 3-byte raw change, so part of this is compression noise. I haven't established why the larger bundles grow.

So this is a consistent raw and gzip win, but not a consistent brotli one. If brotli is the number that matters here, this PR may not be worth taking.

Validation

  • pnpm format:check (not run; pnpm format:files:check on the changed files is clean)
  • pnpm typecheck (not run; pnpm typecheck:files on the four changed runtime files is clean)
  • pnpm test (not run; the local machine is too loaded for the full suite)
  • targeted tests: the 40 host-descriptor test files (auto-memo*, createelement-passthrough-children, deopt-*, descriptor-*, non-jsx-return, portal-into-deopt-host, ssr-deopt-list-identity, svg-deopt, vite-descriptor-helpers, universal-renderer, and the host and descriptor files under hydration/) pass in octane and octane-prod: 80 files, 1,864 tests.
  • Negative control: leaving HOST_ADOPTS, HOST_ADOPT_QUEUE and HOST_PLACE_UPGRADED unset fails 18 of 114 tests in a dev and prod run of deopt-pure-host-upgrade, descriptor-host-capability and hydration/adopted-host-component-clone, mostly with TypeError: HOST_ADOPTS is not a function. Source restored afterwards.
  • node benchmarks/bundle-size/run-minimal.mjs renderable-holes descriptor-children: both reachability gates pass. renderable-holes still drops every host renderer declaration, and descriptor-children keeps them, with both scenarios' rendered results and cleanup checked.
  • pnpm sync leaves the tree clean.
  • Code review: ce-code-review (lite depth, run 20261027-205645-0781e77c) completed with no findings. It traced every hostDriver and HOST_DESCRIPTORS use to its replacement.

Risk / follow-ups

  • The seven bindings are written only by enableHostDescriptors and always together, so a set HOST_BODY implies the rest. Each ! at a call site sits under that guard.
  • The Bundle size review #1921 review job has been failing since 2026-10-21 for lack of the ANTHROPIC_API_KEY secret, so no entry since then has a review.

Provenance

  • An agent produced this diff (agent-authored)

🤖 Generated with Claude Code


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need.


Note

Low Risk
Mechanical API reshaping with guarded call sites and targeted host-descriptor test coverage; no auth, data, or security surface.

Overview
Replaces the single HOST_DESCRIPTORS driver object with seven top-level module bindings (HOST_BODY, HOST_RECONCILE, HOST_ADOPTS, HOST_LAND_PAIR, HOST_UNCHANGED, HOST_ADOPT_QUEUE, HOST_PLACE_UPGRADED). enableHostDescriptors assigns all of them together; HOST_BODY doubles as the “renderer installed” guard (replacing truthy checks on the old object).

Call sites in child slots, de-opt reconciliation, elements, hydration, and lists stop using hostDriver.reconcile / .body / etc. and invoke the bindings directly (still gated so bundles that never install the renderer can drop the code). Optional-driver bundle tests now track HOST_BODY / hostBody instead of HOST_DESCRIPTORS.

No intended runtime behavior change — this is a minifier-friendly size follow-up (patch changeset for octane).

Reviewed by Cursor Bugbot for commit 86685e2. Bugbot is set up for automated code reviews on this repo. Configure here.

…tely

#2249 reached the host renderer through one HOST_DESCRIPTORS object. Apps
that install the renderer reach all seven of its fields, and a minifier keeps
every property name in full: the object literal plus about 14 hostDriver.x
reads at call sites.

Make each entry point its own module binding, set together by
enableHostDescriptors. HOST_BODY is set exactly when the renderer is
installed, so it serves as the installed check, and callers keep the guard
shapes that fold away in a bundle that never installs it. An early return
keeps repeat installs from the public factories to one check, as ??= did.

Against main d44d6d9: js-framework octane-jsx −99 raw / −28 gzip,
descriptor-children −99 raw / −80 gzip, renderable-holes −3 raw / −5 gzip.
Both reachability gates pass.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@github-actions github-actions Bot added agent-authored Diff or issue body substantially produced by an AI agent perf PR: performance work labels Oct 28, 2026
@jonkwheeler
jonkwheeler marked this pull request as ready for review October 28, 2026 00:58
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Oct 28, 2026 •

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
octane-website 86685e2 Commit Preview URL

Branch Preview URL
Oct 28 2026, 11:39 AM

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Oct 28, 2026 •

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
octane-website-mcp 86685e2 Commit Preview URL

Branch Preview URL
Oct 28 2026, 11:40 AM

@github-actions

github-actions Bot commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

Benchmark report

  • 🔴 bundle-size: 13 value(s) increased

Compares 68b56c656, the merge commit's first parent with d72996868 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 2.417 2.392 ±0.0% −1.9% … +4.1% ⚪ within noise
octane-tsrx replace 4.425 4.533 +2.2% ±0.0% … +3.3% ⚪ within noise
octane-tsrx add 2.225 2.208 ±0.0% −2.3% … +2.4% ⚪ within noise
octane-tsrx update 0.087 0.087 +0.7% ±0.0% … +1.4% ⚪ within noise
octane-tsrx select 0.005 0.005 ±0.0% −1.0% … +0.0% ⚪ within noise
octane-tsrx swap 0.015 0.015 +1.3% +1.0% … +2.5% ⚪ within noise
octane-tsrx remove 0.012 0.012 +0.5% −1.0% … +1.6% ⚪ within noise
octane-tsrx runlots 20.250 19.900 −4.0% −9.3% … −1.8% ⚪ within noise
octane-tsrx select_lots 0.006 0.006 −0.6% −1.2% … −0.6% ⚪ within noise
octane-tsrx clear 41.033 40.533 −0.7% −1.1% … −0.2% ⚪ within noise
octane-jsx run 3.025 3.017 ±0.0% −1.5% … +0.0% ⚪ within noise
octane-jsx replace 4.875 4.933 ±0.0% −0.0% … +2.0% ⚪ within noise
octane-jsx add 2.833 2.783 ±0.0% −3.3% … ±0.0% ⚪ within noise
octane-jsx update 0.151 0.148 −0.3% −1.4% … +0.0% ⚪ within noise
octane-jsx select 0.080 0.080 −0.3% −1.3% … +1.3% ⚪ within noise
octane-jsx swap 0.126 0.126 +0.0% −0.5% … +1.3% ⚪ within noise
octane-jsx remove 0.103 0.104 −0.3% −1.9% … +1.1% ⚪ within noise
octane-jsx runlots 25.217 26.208 −1.4% −2.4% … +1.6% ⚪ within noise
octane-jsx select_lots 0.813 0.833 +2.3% +1.6% … +3.4% ⚪ within noise
octane-jsx clear 41.942 43.517 +2.1% +0.2% … +2.8% ⚪ within noise

All 64 work counters are unchanged.

Application bundle size (bytes)

target metric base head Δ
octane-tsrx bindings_js_raw 681,036 680,937 −99 (−0.0%) 🟢
octane-tsrx bindings_js_gzip 225,857 225,767 −90 (−0.0%) 🟢
octane-tsrx bindings_js_brotli 192,760 192,775 +15 (+0.0%) 🔴
octane-tsrx bindings_app_gzip 118,666 118,665 −1 (−0.0%) 🟢
octane-tsrx bindings_app_brotli 98,703 98,707 +4 (+0.0%) 🔴
octane-tsrx bindings_fw_raw 323,128 323,029 −99 (−0.0%) 🟢
octane-tsrx bindings_fw_gzip 107,191 107,102 −89 (−0.1%) 🟢
octane-tsrx bindings_fw_brotli 94,057 94,068 +11 (+0.0%) 🔴
octane-tsrx wayfinder_js_brotli 102,231 102,222 −9 (−0.0%) 🟢
octane-tsrx threadline_esbuild_js_gzip 59,365 59,364 −1 (−0.0%) 🟢
octane-tsrx threadline_esbuild_js_brotli 52,357 52,364 +7 (+0.0%) 🔴
octane-tsrx pagecraft_oxc_js_raw 546,898 546,799 −99 (−0.0%) 🟢
octane-tsrx pagecraft_oxc_js_gzip 172,481 172,466 −15 (−0.0%) 🟢
octane-tsrx pagecraft_oxc_js_brotli 146,682 146,598 −84 (−0.1%) 🟢
octane-tsrx pagecraft_esbuild_js_raw 582,336 582,237 −99 (−0.0%) 🟢
octane-tsrx pagecraft_esbuild_js_gzip 188,944 188,877 −67 (−0.0%) 🟢
octane-tsrx pagecraft_esbuild_js_brotli 160,640 160,672 +32 (+0.0%) 🔴
octane-tsrx full_fw_raw 535,616 535,517 −99 (−0.0%) 🟢
octane-tsrx full_fw_gzip 168,237 168,175 −62 (−0.0%) 🟢
octane-tsrx full_fw_brotli 142,999 143,012 +13 (+0.0%) 🔴
octane-jsx js_raw 148,456 148,359 −97 (−0.1%) 🟢
octane-jsx js_gzip 48,808 48,764 −44 (−0.1%) 🟢
octane-jsx js_brotli 43,277 43,271 −6 (−0.0%) 🟢
octane-jsx app_gzip 3,512 3,513 +1 (+0.0%) 🔴
octane-jsx app_brotli 2,889 2,883 −6 (−0.2%) 🟢
octane-jsx fw_raw 137,656 137,559 −97 (−0.1%) 🟢
octane-jsx fw_gzip 45,296 45,251 −45 (−0.1%) 🟢
octane-jsx shell_js_raw 338,201 338,102 −99 (−0.0%) 🟢
octane-jsx shell_js_gzip 110,449 110,388 −61 (−0.1%) 🟢
octane-jsx shell_js_brotli 95,993 95,946 −47 (−0.0%) 🟢
octane-jsx shell_app_gzip 769 771 +2 (+0.3%) 🔴
octane-jsx shell_app_brotli 669 668 −1 (−0.1%) 🟢
octane-jsx shell_fw_raw 337,098 336,999 −99 (−0.0%) 🟢
octane-jsx shell_fw_gzip 109,680 109,617 −63 (−0.1%) 🟢
octane-jsx shell_fw_brotli 95,324 95,278 −46 (−0.0%) 🟢
octane-jsx shell_client_js_raw 282,848 282,749 −99 (−0.0%) 🟢
octane-jsx shell_client_js_gzip 91,820 91,793 −27 (−0.0%) 🟢
octane-jsx shell_client_js_brotli 80,468 80,510 +42 (+0.1%) 🔴
octane-jsx shell_client_app_gzip 774 780 +6 (+0.8%) 🔴
octane-jsx shell_client_app_brotli 669 678 +9 (+1.3%) 🔴
octane-jsx shell_client_fw_raw 281,737 281,638 −99 (−0.0%) 🟢
octane-jsx shell_client_fw_gzip 91,046 91,013 −33 (−0.0%) 🟢
octane-jsx shell_client_fw_brotli 79,799 79,832 +33 (+0.0%) 🔴
octane-jsx full_fw_raw 535,616 535,517 −99 (−0.0%) 🟢
octane-jsx full_fw_gzip 168,237 168,175 −62 (−0.0%) 🟢
octane-jsx full_fw_brotli 142,999 143,012 +13 (+0.0%) 🔴

65 other measured values are unchanged.

Public-import reachability bundles (bytes)

target metric base head Δ
hydrate-frame raw 343,218 343,119 −99 (−0.0%) 🟢
hydrate-frame gzip 110,649 110,588 −61 (−0.1%) 🟢
hydrate-frame brotli 96,323 96,255 −68 (−0.1%) 🟢
descriptor-children raw 144,117 144,019 −98 (−0.1%) 🟢
descriptor-children gzip 47,223 47,126 −97 (−0.2%) 🟢
descriptor-children brotli 42,074 42,033 −41 (−0.1%) 🟢
split-shell raw 396,436 396,337 −99 (−0.0%) 🟢
split-shell gzip 129,512 129,474 −38 (−0.0%) 🟢
split-shell brotli 113,069 112,900 −169 (−0.1%) 🟢
split-shell-runtime raw 323,837 323,738 −99 (−0.0%) 🟢
split-shell-runtime gzip 104,547 104,505 −42 (−0.0%) 🟢
split-shell-runtime brotli 90,498 90,334 −164 (−0.2%) 🟢
binding-base-ui-vite raw 156,876 156,780 −96 (−0.1%) 🟢
binding-base-ui-vite gzip 51,597 51,542 −55 (−0.1%) 🟢
binding-base-ui-vite brotli 45,934 45,806 −128 (−0.3%) 🟢
binding-base-ui-esbuild raw 200,424 200,325 −99 (−0.0%) 🟢
binding-base-ui-esbuild gzip 67,670 67,614 −56 (−0.1%) 🟢
binding-base-ui-esbuild brotli 59,922 59,847 −75 (−0.1%) 🟢
binding-aria-esbuild brotli 2,649 2,648 −1 (−0.0%) 🟢
binding-radix-vite raw 154,225 154,127 −98 (−0.1%) 🟢
binding-radix-vite gzip 50,582 50,551 −31 (−0.1%) 🟢
binding-radix-vite brotli 45,049 45,026 −23 (−0.1%) 🟢
binding-radix-esbuild raw 197,936 197,837 −99 (−0.1%) 🟢
binding-radix-esbuild gzip 66,785 66,719 −66 (−0.1%) 🟢
binding-radix-esbuild brotli 59,166 59,060 −106 (−0.2%) 🟢
binding-apollo-client-vite raw 302,858 302,759 −99 (−0.0%) 🟢
binding-apollo-client-vite gzip 94,795 94,749 −46 (−0.0%) 🟢
binding-apollo-client-vite brotli 84,095 84,079 −16 (−0.0%) 🟢
binding-apollo-client-esbuild raw 354,455 354,356 −99 (−0.0%) 🟢
binding-apollo-client-esbuild gzip 115,301 115,239 −62 (−0.1%) 🟢
binding-apollo-client-esbuild brotli 101,766 101,688 −78 (−0.1%) 🟢

110 other measured values are unchanged.

Main's new HOST_DESCRIPTORS guards (#2258) now read HOST_BODY, the
binding this branch sets exactly when the host renderer is installed.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@trueadm
trueadm merged commit ba9c3a8 into main Oct 28, 2026
32 checks passed
@trueadm
trueadm deleted the perf/host-descriptor-driver-bindings branch October 28, 2026 11:59
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.

2 participants