Skip to content

perf: initialize optional SSR identity in component frames - #1152

Merged
domgan-oai merged 5 commits into
octanejs:mainfrom
openai-oss-forks:codex/perf-unused-signal-ssr-context-20260919
Sep 19, 2026
Merged

domgan-oai merged 5 commits into
octanejs:mainfrom
openai-oss-forks:codex/perf-unused-signal-ssr-context-20260919

Conversation

@domgan-oai

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

Copy link
Copy Markdown
Contributor

Summary

Potential signal bindings currently append their lazy identity recipe to an already-created SSR component frame. Initialize those optional fields, including the eventual identity cache, in the initial frame shape instead. Frames without signal capability keep their existing nine-field shape.

Why

In the matched Node 24 V8 consumer, the old frame needed a separate property backing array both before and after the first real handle. The candidate keeps the recipe and cached identity in object slots. Late activation, keyed instance identity, list keys, namespace handling, and restoration of the ambient server context retain their existing behavior.

Refs #1130 (SSR frame allocations; this does not remove context restoration envelopes).

Validation

  • Original owning matrix: 241 SSR and signal behavior cases across development, production, and Strong compilation.

  • pnpm ci:workflow:test (216 passing after the runtime main refresh), including the new frame-work guard.

  • Scoped TSRX typecheck, scoped formatting, and pnpm sync.

  • Four broken variants rejected: old post-construction recipe writes, unreserved identity cache, lost parent identity, and lost list identity.

  • Matched stock SSR and streaming output; 15 public production closures verified.

  • Signed main refresh 826169cbfa8004b680b3999a3e29913d45e852a5 includes landed split-Hydrate and fixed-style fixes plus the latest streaming-SSR documentation. The documentation update changes no Octane runtime/compiler source, package or lockfile. Full current-head GitHub CI passes all 26/26 jobs (run 35466087525); current-head Bugbot passes with no unresolved review threads. Refreshed local checks pass: 30 public SSR identity/style cases, 216 workflow guards, scoped types/format, sync and diff checks, with no generated drift.

Risk / follow-ups

This is an allocation change, with no reliable CPU speed claim. All 13 client/engine/native/binding closures are byte-identical. Ordinary SSR grows by 28 raw / 10 gzip / 15 Brotli bytes; the actual used SSR consumer grows by 26 raw / 28 gzip / 0 Brotli bytes. The V8 layout evidence is specific to the pinned Node 24 runtime; the deterministic guard checks initial fields and later writes. Restoration envelopes remain allocated because a descendant can activate signals during the pass.

Provenance

  • An agent produced this diff (agent-authored)

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


Note

Medium Risk
Touches core server SSR frame allocation for signal-capable modules; behavior is guarded by extensive tests but allocation layout changes can affect V8-specific performance and edge cases around late identity materialization.

Overview
SSR component frames now bake optional signal-identity recipe fields (signalParentKey, signalInvocationSite, signalListKeys, signalKey) and a reserved signalInstanceKey cache slot into the initial frame object when SERVER_SIGNAL_BINDINGS_POTENTIAL applies, instead of assigning those properties after the nine-field frame is created. Ordinary frames without signal capability stay at the nine-field shape.

A new scoped-signals guard (ssr-component-frames.test.mjs) compiles matched SSR workloads in dev and production, instruments the server runtime to count recipe writes and frame widths, and asserts zero post-construction recipe assignments, correct 9 vs 14 field shapes, unchanged HTML, and safe restoration of a pre-existing globalThis.__serverFrameWork descriptor. CI workflow tests and benchmark README document the gate; an octane patch changeset records the release note.

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

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