Components: Optimize SlotFill rendering to avoid props destructuring #10921
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.
Related: #5952
This pull request seeks to optimize the rendering of components created through
createSlotFill
to avoid an unnecessary props destructuring. These components are considered to be hot code paths, being called upwards of thousands of times in the authoring of one or few paragraphs of text (itself an issue worth exploring).The change is simple; since React considers
children
as a prop (and, in fact, always normalizes back to a prop anyways), there's no need to extract it separately, and it can be included in the default spread of props.The issue boils down to the effective transpiled output of a destructuring:
children
treated separatelychildren
included in...props
spreadNote in above the iteration which would occur through
_objectWithoutProperties
in the separate treatment, which is avoided altogether in the implementation proposed here.Testing instructions:
There should be no effective difference in behavior.
Ensure Slot/Fill works as expected (sidebar, toolbars, plugins).