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.
Details
#2442 introduced a small performance regression, notably in the
dom-table-create-10k
benchmark. After tracking it down, most of the regression can be reduced to this simple change.My hunch is that adding the
get isHydrating
changes the object shape in such a way that V8 has a harder time optimizing the other functions on the object, which are frequently called. So switching from a getter to a regular function actually gives us a decent performance win across most of the benchmarks:(The above is comparing this PR versus current master – 100 sample size, 1% horizon, 20 minute timeout.)
Interestingly, the
dom-light-styled-component-create-1k-same
benchmark does indeed seem to be consistently regressed, by around ~2%. (I ran the test again to confirm.) But I'd say it's worth it, given it's small (~1ms) and the other benchmarks are mostly improved.A further optimization would be to get rid of the
renderer
object entirely. It only exists so that we can have a nice TypeScript abstract class for the DOM/server renderers. Potentially, we could just hoist all of its properties into the top-level exports on a module.Does this pull request introduce a breaking change?
Does this pull request introduce an observable change?
GUS work item
W-10099550