perf: diff single-child render results without a wrapper array - #5241
Closed
JoviDeCroock wants to merge 1 commit into
Closed
perf: diff single-child render results without a wrapper array#5241JoviDeCroock wants to merge 1 commit into
JoviDeCroock wants to merge 1 commit into
Conversation
diff() and diffElementNodes() wrapped every non-array render result in a fresh [result] array before calling diffChildren(). The #2618 statistics put exactly-one-child at 84% of all children diffs, so that is one throwaway allocation per component and per element on nearly every update. diffChildren now accepts the bare value and constructNewChildrenArray reads it directly. Core -6 B gz / -5 B br. Local paired bench (playwright, interleaved): text-update -3..-6% warm, hydrate1k -3.5% cold, create/replace within noise.
📊 Tachometer Benchmark ResultsSummaryduration
usedJSHeapSize
Resultscreate10kduration
usedJSHeapSize
filter-listduration
usedJSHeapSize
hydrate1kduration
usedJSHeapSize
many-updatesduration
usedJSHeapSize
replace1kduration
usedJSHeapSize
run-warmup-0
run-warmup-1
run-warmup-2
run-warmup-3
run-warmup-4
run-final
text-updateduration
usedJSHeapSize
tododuration
usedJSHeapSize
update10th1kduration
usedJSHeapSize
|
|
Size Change: -6 B (-0.04%) Total Size: 15.9 kB 📦 View Changed
ℹ️ View Unchanged
|
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.
diff()anddiffElementNodes()wrapped every non-array render result in a fresh[result]array before callingdiffChildren(). Exactly-one-child is by far the most common children diff, so that was a throwaway allocation per component and per element on nearly every update.diffChildrennow takes the bare value andconstructNewChildrenArrayreads it directly.Single text children was the prevailing thing according to #2618