Skip to content

perf: skip SSR transition arm scans without candidates - #1000

Merged
domgan-oai merged 2 commits into
octanejs:mainfrom
openai-oss-forks:codex/skip-empty-vt-claim-981
Sep 8, 2026
Merged

domgan-oai merged 2 commits into
octanejs:mainfrom
openai-oss-forks:codex/skip-empty-vt-claim-981

Conversation

@domgan-oai

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

Copy link
Copy Markdown
Contributor

Summary

  • Skip the vtSsrClaimArm HTML scan when the active SSR pass has rendered no ViewTransition candidate. This addresses the no-ViewTransition Suspense arm item in Track V8 performance audit findings across runtime, SSR, universal core, and compiler output #981.
  • Add a buffered and streaming regression for ordinary @try content, fallback, and revealed markup; include an octane patch changeset.
  • Repair the required Three compatibility lane for the current release gap: typecheck and test the newest matching runtime/typings pair, then run the same compatibility suite against the exact newest Three runtime.

Why

Every ordinary Suspense/@try content or fallback arm currently searches its rendered HTML for a candidate attribute even on pages with no ViewTransition. On nested boundaries this repeatedly flattens the same cons-string subtree. The existing pass flag is set by ViewTransition before an arm is claimed, and is saved/restored for retries and nested renders, so a false value rules out renderer-generated candidates.

The first PR head exposed a release timing failure in the required Three compatibility job: [email protected] was published before matching @types/three, so the previous @types/[email protected] install could not resolve. The adjusted lane retains typechecking against a matching pair and exercises the newest runtime independently.

Validation

  • Same-toolchain source-bundle SSR checks on the merged main baseline and this branch in development and production: ordinary content/fallback output and a real ViewTransition vt-enter claim behaved as expected. A source-only streaming shell and decoded reveal segment matched on both heads. Mutants that drop no-candidate arm HTML or skip actual candidates each turned the corresponding behavioral assertion red; the restored implementation passed.
  • Focused production SSR ABAB probe on Node 26.4.0: 12 nested no-ViewTransition ssrTry boundaries around 1,000 spans, 3,000 warmups and five 10,000-render rounds per sample, charging Buffer.byteLength for response flattening. Median per render baseline 0.02102 / 0.02063 ms, candidate 0.00512 / 0.00515 ms. Both builds emitted exactly 35,416 bytes, 24 opening markers and the same SHA-256. This isolates the arm-scan cost; it is not a claim about typical application throughput.
  • The source-only production SSR bundle changed from 242,865 raw / 54,449 gzip bytes to 242,908 raw / 54,456 gzip (+43/+7).
  • git diff --check, direct version generation, package inventory, and context-budget checks passed. The changed TS/Markdown files passed scoped Prettier formatting with the repository's base settings and without its unavailable plugins.
  • The CI workflow edit passed YAML and shell parsing, Node syntax, scoped formatting (base settings without unavailable plugins), diff checks, and focused workflow assertions. A reviewer checked the two-install version assertions. Full local workflow tests await the pinned install.
  • Full pinned install, pnpm sync, Vitest, and typecheck: the configured local registry returned 403 for pinned @tsrx/[email protected] and could not supply @tsrx/[email protected] offline. The current-head CI will run these checks.
  • Current-head CI on 91e48e7e6b37840bf663061b619230f22a97e583: all 26 jobs passed, including the repaired Three compatibility lane, all Node and React parity shards, typecheck, lint, browser integration, and CI provenance. Cursor Bugbot passed with no review comments.

Risk / follow-ups

  • The guard is conservative: a pass that rendered then discarded a ViewTransition can still scan extra arms. Authored vt-*-x attributes are internal staging names; on a no-ViewTransition buffered arm this change leaves them untouched rather than claiming them, while other emission paths may still strip them.
  • Production fixture and browser throughput effects remain unmeasured locally because the pinned dependencies could not be installed; CI will verify correctness on the current head.

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

Low Risk
Conservative guard on an internal SSR optimization path; ViewTransition claiming is unchanged when candidates exist, with new regression coverage for ordinary Suspense output.

Overview
SSR no longer scans every Suspense @try arm HTML for ViewTransition markers when the render pass never emitted any.

vtSsrClaimArm now returns the arm HTML unchanged when VT_SSR_HAS_CANDIDATES is false, avoiding repeated tag parsing on nested boundaries on pages without ViewTransition. Behavior when transitions are present is unchanged because the flag is still set during annotation/claim.

A new Vitest case covers ordinary buffered and streamed Suspense content, fallback, and post-reveal markup so non–ViewTransition arms stay intact. An octane patch changeset documents the fix.

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

@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
@domgan-oai
domgan-oai marked this pull request as ready for review September 8, 2026 19:43
@domgan-oai
domgan-oai merged commit c92b932 into octanejs:main Sep 8, 2026
31 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