Repository navigation
perf: skip unchanged composed class writes - #996
Merged
domgan-oai merged 4 commits intoSep 8, 2026
Merged
Conversation
domgan-oai
marked this pull request as ready for review
September 8, 2026 15:43
Closed
68 of 84 tasks
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.
Summary
classbindings and skip unchanged DOM class writes on update. This addresses the remaining class-write item in Track V8 performance audit findings across runtime, SSR, universal core, and compiler output #981.Why
Fresh object and array literals have a new identity on every render, even when
normalizeClassreturns the same string. The compiler currently omits the previous-value binding field and calls the DOM class setter unconditionally. In a repeated row this invokes browser class invalidation for unchanged values.Changes
Validation
node --check packages/octane/src/compiler/compile.jsgit diff --checkand scoped cached Prettier check for changed JS/TS/Markdownnode scripts/workspace-packages.mjs --checkpnpm sync, local Vitest and typecheck: the configured dependency registry is currently preventing the pinned TSRX package from installing in a fresh worktree;generate-version.mjsran without changing tracked files.window.__benchFlush = () => flushSync(() => {})adapter so each dispatched event commits before verification; both sides pass all eight correctness targets, with exact changed-row class writes of 25 and identical DOM census. Timings on separate hosted runners are inconclusive.3d18ef459: 26/26 jobs successful. An unrelated pristine Input OTP browser selection test failed on attempt 1 and passed on the identical-head retry.Risk / follow-ups
classon an unrelated render. It matches the existing value guard for scalar class bindings.Provenance
agent-authored)Need help on this PR? Tag
@codesmith-botwith what you need. Autofix is disabled.Note
Medium Risk
Changes reactive class DOM write timing for fresh literals (aligned with scalar
*IfChangedguards), so externally mutated classes may not be reasserted on unrelated re-renders; core binding and SVG routing paths are touched.Overview
Fresh object/array/function
classbindings no longer hit the DOM on every render whennormalizeClassproduces the same string. The compiler now routes those updates throughupdateFreshClassName/updateFreshClassAttr, caches the composed string in the binding bag’s_prevfield (including deferred mounts), and normalizes fresh literals on mount/update so empty compositions still emitclass=""instead of removing the attribute.The eval client runtime re-exports the new helpers. Tests use
MutationObserverto assert skippedclassmutations on no-op re-renders (HTML objects and SVG arrays), and the suspended-root fixture now covers objectclassduring scope hold/rollback.Reviewed by Cursor Bugbot for commit 3d18ef4. Bugbot is set up for automated code reviews on this repo. Configure here.