perf(SprayBrush): enhance perf using new Group #7675
Merged
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.
This PR is an excellent demonstration of the power of the new Group and what can be unlocked using it
control
perf
Basically it reduces computation cost by iterating only once over the spray dots instead of a number of times.
It split up the dots into a number of groups that act as buffers to cut down iterations.
I need to get these buffers to render cache once they're maxed out and then performance will rise even more (splitting the rendering of the entire spray into smaller chunks and then at mouseup the create path is a group of groups that have already been cached so overhead will be minimal)
Will merge once v6! stabilizes
The buffering approach can/should be used by canvas for perf
If we wrap the result of the spray brush with another group we enhance perf even more in case it is used with clip path or in other cases that invalidate cache.
In action
You'll see that the dots double every second or so. That's the buffering group.
Notice that normally there is a massive frame drop on mouse up and here, even though the spray is huge there is no visible drop.
Zoom in on mouse up
spray1.mp4