Repository navigation
perf(ssr): skip reaggregation of canonical attributes - #964
Merged
Merged
Conversation
jonkwheeler
marked this pull request as ready for review
September 5, 2026 04:45
Contributor
Author
|
Performance workflow validation is complete at
The PR description records the two primary workload gains (15.52% and 17.36%) and the repeatable late-alias fallback cost (4.04% and 4.97%). |
14 of 21 tasks
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.
Production SSR currently builds a second attribute map and an ordered array even when all final attribute names are already canonical. This change serializes those entries directly from the existing raw-writer map, preserving insertion order and final values. Aliases and noncanonical HTML casing retain the existing aggregation path.
The production-only check runs after every source read. Serialization still uses the existing escaping, filtering, class/style, namespace, and form-control rules. There are no compiler, client-runtime, public API, or persistent-cache changes.
Performance evidence
Profiled the existing
deopt-page/octane-fastSSR fixture before choosing the optimization: attribute aggregation accounted for 18.3% CPU self time. The fixture renders 300 cards, 601 components, and 300 aggregated attribute sets.Two independent series used fresh processes in ABBAABBA order, four samples per version, 5-second steady windows after 0.5-second warmup. Each render includes response-body materialization. The score is the median of the four raw steady-window mean render times; no control normalization was applied.
Tradeoff: a late alias makes the new scan fall back to the original path, adding a repeatable 4-5% cost in that control. The confirmation median is just 0.03 percentage points below the preregistered 5% material-regression cutoff; two individual confirmation pairs exceeded 5%. This is a measured canonical-attribute improvement, not a universal SSR speedup.
The primary gain exceeded the registered 5.87% unchanged-run noise in both series. Every primary pair improved and the version ranges were disjoint. Confirmation baseline spread was 11.95% because one run was slower; even the smallest paired improvement was 13.34%. The escape-heavy control stayed within its independently measured noise. Descriptor, waterfall, replay/resource, and late-alias aggregate controls passed the preregistered gates. All 13 fixture modes produced matching complete responses; resource HTML, head, and CSS outputs also matched separately.
Measured on Apple M3 arm64, Node 22.22.2 / V8 12.4, against
28907dbd81c51d99732216d871c742fab2d3370a. Results describe these workloads on this machine. The measured fixture bundle grows 554 raw bytes / 113 gzip bytes; the resource fixture bundle is unchanged. Scratch profiling and comparison harnesses are not shipped.Validation
pnpm testsuite was not run locally; targeted ownership suites were used for this 27-line runtime change./,/docs/core-apis, and/docs/bindings, including state updates, form actions, and category filtering; no console errors.Provenance
agent-authored)Note
Medium Risk
Touches core production attribute serialization semantics; regressions would change HTML output or prop read/coercion order, though behavior is heavily covered by new bundled SSR tests.
Overview
Production SSR now takes a fast path in
ssrAttrswhen every collected prop name is already canonical (no alias pairs likeclassName/class, and HTML names are lowercased as expected). In that case it serializes straight from the existing raw-writerMapinstead of building the second resolved map and sort path, while still honoring spread precedence, coercion order, and the samessrAttrEntryfiltering (form controls,dangerouslySetInnerHTML, etc.).When any name would need normalization or alias merging, behavior stays on the existing aggregation path (dev builds always use that path).
Adds production-bundled SSR tests for spread/getter read order, coercion and errors, alias winners, SVG/MathML/custom elements, form control projection, and raw HTML—plus an octane patch changeset.
Reviewed by Cursor Bugbot for commit b04e32e. Bugbot is set up for automated code reviews on this repo. Configure here.
Need help on this PR? Tag
@codesmith-botwith what you need. Autofix is disabled.