Skip to content

perf: stabilize SSR frame namespace shapes - #999

Merged
domgan-oai merged 3 commits into
octanejs:mainfrom
openai-oss-forks:codex/seed-ssr-frame-namespace-981
Sep 8, 2026
Merged

domgan-oai merged 3 commits into
octanejs:mainfrom
openai-oss-forks:codex/seed-ssr-frame-namespace-981

Conversation

@domgan-oai

@domgan-oai domgan-oai commented Sep 8, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Seed Frame.namespace as the last field in all four server frame literals, including canonical roots and discovery replays. Child frames now inherit the namespace within their literal instead of adding a property afterward. This addresses the SSR frame shape item in Track V8 performance audit findings across runtime, SSR, universal core, and compiler output #981.
  • Add a buffered SSR regression covering suspended component retries across SVG and foreignObject HTML, dynamic host attribute casing, and distinct useId values; include an octane patch changeset.

Why

The former root and discovery frames lacked namespace while child frames added it after allocation. V8 assigned different maps to the frames consumed by shared SSR paths and stored the child field in a separate property array. The new literal order is identical across all frame allocations.

Validation

  • pnpm sync and generated-file checks on the initial fork-main base. After merging live upstream main, the pinned install and pnpm sync are blocked by the configured registry returning 403 for @tsrx/[email protected]; direct version generation, package-inventory check, and context-budget check passed without generated changes.
  • pnpm typecheck, source-scoped typecheck, git diff --check, and scoped formatting passed on the initial fork-main base. Post-merge typecheck and formatting require the missing pinned dependencies; the three-file diff against upstream main has no whitespace errors. The live-base current-head CI passed typecheck, lint, and the full test matrix.
  • Before the live-base merge, five focused SSR, streaming, and conformance suites passed 212/212 assertions in dev and production; the production-bundle suite also passed (18/18 across it and the repeated isolation suite). The current-head CI passed all test shards.
  • The new test fails in both projects when child-frame namespace inheritance is deliberately removed; it passes on the restored implementation.
  • Same-worktree production SSR throughput ABAB on fork main before the live-base merge (CONFIGS=waterfall node benchmarks/ssr-throughput/run.mjs 2 --quick): waterfall d1 median baseline 0.040750/0.041125 ms, candidate 0.040583/0.040917; d2 baseline 0.045625/0.045917 ms, candidate 0.045791/0.046042. Response bytes, hydration markers, and pass counts matched. The timing differences are within run noise; no throughput gain is claimed.
  • On that pre-merge toolchain, the production fixture bundle was 160,862 raw / 43,953 gzip bytes on fork main versus 160,919 raw / 43,963 gzip bytes on this branch; live-base bundle size is unmeasured locally.
  • A Node 26.4.0 synthetic mirror of the exact frame literal shapes reported separate baseline root/discovery maps versus child before the namespace assignment, and one candidate map from construction. Baseline child namespace occupied a PropertyArray; candidate stores it in-object. This is mechanism evidence, not a workload speed claim.
  • Current pushed-head CI on 664b52a00b passed 26/26 jobs (run 34267069614).

Risk / follow-ups

  • Root and discovery frames now reserve the field even when no parser namespace is active; the response and retry behavior matched on the measured base. The pre-merge SSR fixture bundle gained 10 gzip bytes. Current-base throughput and bundle effects remain unmeasured locally due to the pinned registry 403; current-head CI covers correctness.

Provenance

  • An agent produced this diff (agent-authored)

Note

Low Risk
Internal SSR frame allocation and typing only; behavior is guarded by a new foreign-content retry regression test with no auth or data-path changes.

Overview
SSR frame objects now always include namespace at creation time instead of adding it on child frames after allocation. The Frame type treats namespace as a required field that may be undefined, and every frame literal (root, child, and discovery replay) seeds it—children inherit via explicitNamespace ?? pf.namespace in the literal, replacing the old frame.namespace = … assignment.

This keeps a single V8 object shape across shared SSR paths while parser context (HTML vs SVG vs MathML) should behave the same through renders and suspense retries.

A new SSR test covers suspended retries inside <svg> and <foreignObject>: SVG keeps kebab-case attributes, HTML keeps camelCase, and useId stays distinct per host.

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


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

@github-actions github-actions Bot added agent-authored Diff or issue body substantially produced by an AI agent perf PR: performance work labels Sep 8, 2026
# Conflicts:
#	packages/octane/src/runtime.server.ts
@domgan-oai
domgan-oai merged commit 7fca4d3 into octanejs:main Sep 8, 2026
32 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