Repository navigation
perf: reduce SSR HTML payload and hydration markers - #710
Merged
Merged
Conversation
domgan-oai
marked this pull request as ready for review
August 11, 2026 22:03
9 tasks
9 of 10 tasks
trueadm
added a commit
that referenced
this pull request
Oct 28, 2026
…tors only A function inside an array child renders as a body, which descriptor-list-hydrate pins (#710), so every bundle with an array hole needs the keyed list's per-item Blocks. Drop the text-only list, the CHILD_LISTS installer and the createPortalChild compiler proof. Keep the descriptor gates (ELEMENT_DESCRIPTORS, HOST_DESCRIPTORS) and the hole-free residue fixes. The reachability check now asserts that a Strong app keeps no descriptor-only declarations and no descriptor-guarded branch of child-slots.ts or deopt.ts. Co-Authored-By: Claude Opus 5.5 <[email protected]>
6 of 7 tasks
trueadm
added a commit
that referenced
this pull request
Oct 28, 2026
…ithout a factory (#2258) * perf(octane): ship renderable hole value kinds only with their creators A renderable hole now handles a non-primitive kind only when something in the bundle can create it. Descriptor factories install ELEMENT_DESCRIPTORS, and every factory of a list item other than text (descriptors, compiled children and maps, createPortal) installs the keyed list (CHILD_LISTS). Without one, an array or iterable child renders as a text list: one Text per leaf, keyed by index path, adopting the server's per-item ranges when hydrating. The compiler routes a portal that a module-local component returns to createPortalChild, which supports only lone portal children. Hole-free bundles also drop descNeedsBlocks, deoptChildNamespace, childrenIterator and isHostDescriptor. Co-Authored-By: Claude Opus 5.5 <[email protected]> * perf(octane): keep the keyed child list in every bundle, gate descriptors only A function inside an array child renders as a body, which descriptor-list-hydrate pins (#710), so every bundle with an array hole needs the keyed list's per-item Blocks. Drop the text-only list, the CHILD_LISTS installer and the createPortalChild compiler proof. Keep the descriptor gates (ELEMENT_DESCRIPTORS, HOST_DESCRIPTORS) and the hole-free residue fixes. The reachability check now asserts that a Strong app keeps no descriptor-only declarations and no descriptor-guarded branch of child-slots.ts or deopt.ts. Co-Authored-By: Claude Opus 5.5 <[email protected]> --------- Co-authored-by: Claude Opus 5.5 <[email protected]>
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
Reduce Octane's hydratable HTML without changing visible markup, removing necessary hydration ownership, or adding SSR overhead. The compiler and runtime now reuse boundaries that are already proven to own a keyed item or control-flow arm, and streamed Suspense segments escape only script-shaped HTML tokens.
Why
Octane's ordinary 50-card news fixture is only 34 raw HTML bytes larger than React, but it hides the real problem: component-heavy and binding-style pages stack redundant hydration ranges, while streamed segments previously expanded every
<into\u003c. Production comparisons against the same visible markup show substantially larger and independently fixable costs.@if/@switch, 300 rowsThese are separate fixtures, not additive savings on one response. Stream compression varies slightly with per-response boundary identifiers.
Changes
@foritems. Imported components, explicit component keys, spreads, ambiguous roots, and other unproven shapes retain their existing boundaries.WeakSetregistration, reflection, per-host allocation, or SSR throughput penalty.@if/@elseand@switch/@defaultarms when every arm is proven to be one ordinary host. Incomplete branches, setup statements, fragments, components, hoisted head resources, and streaming boundaries remain conservatively marked.docs/ssr-html-payload-audit.md.Validation
env NODE_OPTIONS=--no-experimental-webstorage node node_modules/vitest/vitest.mjs run packages/octane/tests --project octane --project octane-prod --reporter=dot --silent=passed-only— 12,065 core tests across 808 files passed, covering development and production modes.env NODE_OPTIONS=--no-experimental-webstorage node node_modules/vitest/vitest.mjs run --project tanstack-router --project tanstack-router-ssr-query --project tanstack-start --project tanstack-query --project jotai --project rspack-plugin --reporter=dot --silent=passed-only— 297 downstream tests across 41 files passed../node_modules/.bin/tsgo --noEmit -p packages/octane/tsconfig.json.pnpm --dir benchmarks/ssr-throughput bench:payload— production builds; equivalent visible markup; raw/gzip/Brotli, hydration-comment, and streaming-carrier measurements.pnpm --filter tanstack-start-bench bench:workagainst immutable React, Octane, and minimal-Octane production artifacts selected withSTART_WORK_TARGET_DIR— matching navigation, loaders, status codes, initial state, streamed content, and route payload budgets.env pnpm_config_verify_deps_before_run=warn pnpm sync.pnpm format:check— root-wide check not run.pnpm typecheck— root-wide check not run; the package-scoped source typecheck above passed.pnpm test— root-wide command not run; the 12,065 core and 297 downstream targeted tests above passed.Risk / follow-ups
<head>comments occupying 2,049 bytes. Its managed-asset ownership attributes may justify a future, explicit core ownership proof, but removing generic head delimiters globally would break foreign-node isolation, cleanup, or multiple-root hydration. This PR deliberately leaves that limitation intact; the measured home route improves only 8,053 → 8,021 raw bytes, while the deferred route improves 10,910 → 10,798 bytes.Provenance
agent-authored)Note
High Risk
Touches hydration ownership across compiler, server serialization, and client adoption, plus security-sensitive streaming carrier escaping. Incorrect proofs could break hydration identity or allow script-carrier termination.
Overview
Shrinks hydratable SSR HTML by omitting proven-redundant ownership markers while keeping visible markup identical.
The compiler now reuses a same-module single-host component range for eligible keyed
@foritems, and lets fully specified host-only@if/@switcharms borrow their outer slot range instead of nesting another pair. Descriptor-authored keyed hosts self-delimit only when the already-serialized child is primitive/empty, preserving accessor/Proxy evaluation order and mixed-item behavior.Streamed Suspense carriers escape only opening/closing
scripttokens (case-insensitive), so ordinary tags and hydration comments stay compact without weakening parser safety.Adds a production payload audit, TanStack Start comment accounting, and broad hydration/streaming regressions covering reordering, mismatch recovery, namespaces, and hostile raw HTML.
Reviewed by Cursor Bugbot for commit c8ec78d. Bugbot is set up for automated code reviews on this repo. Configure here.