-
-
Notifications
You must be signed in to change notification settings - Fork 179
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
Feature: Improve Performance of MergeManyChangeSets with fewer changesets #829
Feature: Improve Performance of MergeManyChangeSets with fewer changesets #829
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Smart optimisation
I had wanted this behavior before, but it wasn't obvious how... When I started digging into |
This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Description
This PR improves the performance of the various
MergeManyChangeSet
operators by reducing the number of changeset that are emitted. Instead of one changeset per change in child changesets, the changes are held until they've all been processed, and the result is then emitted as a single changeset.Impact
All changes from a parent changeset will result in a single downstream changeset. If it adds 2 items and removes 3 others, then the downstream will see a single changeset that adds of the child items from the added parent items and removes all of the child items from the 3 removed parent items.
Updates will result in a single changeset with removal of old child items/adding of new child items.
Logic Overview
By setting a flag before handling any changes to the parent changeset, we can detect if changes to the child changeset are due to parent changes (add/remove) we can avoid emitting them. At the end of handling a parent changeset, all of the changes can be emitted at once.
When the flag is not set, then the child changeset are not the result of parental changes, and they can be emitted immediately.
Other Changes
Creates an overload for
SubscribeSafe
extension method that enables it to be invoked with Action objects instead of justIObserver<T>
.Testing