-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
ref: isParentRemoved to cache subtree #1543
Conversation
🦋 Changeset detectedLatest commit: b10de2e The changes in this PR will be included in the next version bump. This PR includes changesets to release 19 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
@eoghanmurray I think this will substantially improve performance for nested trees. We dont really benchmark these much besides the deep nested tree test I added, but this shows a 30% improvement on the |
@JonasBa totally agree with you, I've spent some time integrating vitest's benchmark features which should help. Here is an example output for this performance improvement, which would suggest that your performance improvement really hit its mark:
|
Nice work @Juice10, is that available on master? I need to rebase some of these PRs, and I will remove the script benchmark change here (iirc I added it because something was broken) |
@JonasBa Not yet on master, but hopefully I'll be able to finish it and create a PR for it today |
Sounds good, I went ahead and reverted the change to the profiling script |
@Juice10 Can we merge this, or do we need a separate review? |
Thanks Jonas! |
Thank you @Juice10! |
isParentRemoved is called super often for each node that we add. I think the current logic results in an On^2 time complexity as each visit to a node traverser the entire chain of parents (please correct me if I'm wrong).
The motivation behind this change is to iterate on the graph once ahead of time which can be done in On time and store the parent nodes which were removed. That way we can query the removed set in O1 time and only perform this lookup once per node
Related to #1271