Repository navigation
perf(ssr): skip redundant loop HTML carriers - #945
Merged
domgan-oai merged 1 commit intoSep 3, 2026
Merged
Conversation
domgan-oai
marked this pull request as ready for review
September 3, 2026 19:57
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
Follow up to #943. Compiled server loops currently wrap each item's serialized HTML in a carrier, then immediately coerce it back to a string during concatenation. Return that string directly from those private item helpers.
The compiler option applies only to the current item body. Public components, opaque children callbacks, and returned fragments keep their carriers; authored early returns, replay identity, hydration boundaries, and client output are unchanged.
Performance evidence
Baseline is merged main
44d50dbc0. The untimed benchmark observer compares complete responses and enforces factory-call budgets:These are source factory calls, not measured V8 heap allocations. The clean production fixture bundle shrinks by 54 bytes. Baseline and candidate HTML/CSS are byte-identical for both card variants, escaping, and hydratable/static control-flow fixtures. The instrumented bundle is never timed.
Four samples per version in ABBAABBA order, using the same production fixtures and
CONFIGS=deopt-page,escape node run.mjs 2 --no-buildon Node 26.4.0/macOS ARM64:Timing ranges overlap and paired directions vary, including in the unchanged descriptor control. Throughput improvement is unproven in these end-to-end fixtures; the demonstrated reductions are wrapper calls and emitted bytes. Full methodology and ranges are in the SSR-throughput README.
Validation
pnpm exec vitest run --project octane --project octane-prod --maxWorkers 4 --silent=passed-only: 935 files, 16,242 tests passed.pnpm exec tsgo --noEmit -p packages/octane/tsconfig.json.tsrx-tsc --noEmitwithtsrx.compilerexplicitly selectingoctane/compiler/volar. Default scoped discovery selects React lowering and also fails on the unchanged baseline; no type workaround is included.pnpm format:check,pnpm typecheck, andpnpm testwere not run locally; the complete core projects and scoped checks above were run.ae132218c, including website/browser integration, examples, React parity, typechecking, lint, and package validation. One unchanged Volar typing test exceeded its 5-second timeout on the first attempt; the focused local reproduction passed in 1.35 seconds and the failed-job retry passed without source or timeout changes. Cursor Bugbot also passed with no findings.Risk / follow-ups
Coverage preserves nested and empty loops, multi-root items, escaped text, public mixed returns, opaque children forwarding, all five server-rendering APIs, and hydration adoption with live events. Broader SSR return-protocol changes and transition/manual-hook optimizations are separate follow-ups.
Provenance
agent-authored)Need help on this PR? Tag
@codesmith-botwith what you need. Autofix is disabled.Note
Medium Risk
Touches SSR compiler return semantics for loop bodies; mitigated by broad contract tests across APIs, streaming, and hydration, with carriers unchanged for public boundaries.
Overview
Compiled
@foritem helpers no longer wrap each iteration’s serialized markup inssrHtml; they return the concatenation string directly, while public components, empty arms, and other SSR bodies still use the carrier so text vs template HTML stays distinguishable.The ssr-throughput harness adds an untimed
ssrHtmlcall counter (instrumented bundle copy) with budgets on the 300-card compiled page, descriptor control, and 10k-hole escape fixture, plus README notes that factory-call counts dropped sharply with byte-identical output and no proven end-to-end timing win.Contract tests add nested/empty lists, hostile escaping, loop children forwarded through component descriptors, all five server render paths, and hydration with click handlers (dev and prod compile).
Reviewed by Cursor Bugbot for commit ae13221. Bugbot is set up for automated code reviews on this repo. Configure here.