Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: optimize arraydiff perf in first render and clear #832

Merged
merged 2 commits into from
Sep 24, 2021

Conversation

pissang
Copy link
Contributor

@pissang pissang commented Sep 24, 2021

Currently, we are using an O(ND) diff algorithm(Myers' Diff Algorithm) in the SVG renderer. But when we do first render or clear all things on canvas. The complex becomes O(N2) because the difference is the whole N. Which will cause a significant performance drop. Especially we can't avoid the first render. So in this PR, I did a simple optimization to handle these two cases. The time of the first frame render comes down to 100ms from the terrible 3000ms for 10k objects.

Also, I found an existing bug that appears after the change in #829 and fixed it.

@pissang pissang merged commit 99449dc into master Sep 24, 2021
@pissang pissang deleted the optimize-arraydiff branch September 24, 2021 06:29
@pissang pissang mentioned this pull request Oct 7, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants