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

Add optimization to SortedSet.unionWith #2624

Merged
merged 3 commits into from Feb 13, 2020
Merged

Conversation

wu-hui
Copy link
Contributor

@wu-hui wu-hui commented Feb 12, 2020

This is a fix to #2620

Basically SortedSet.unionWith does not take the size of the two sets that it is merging into consideration.

What happens is, if there are two set: A that is empty, and B that has size of N. The union would take O(N*logN) while it could have been a no-op.

@@ -134,7 +134,7 @@ function initializeApp(
({
getToken: async () => ({ accessToken: accessToken }),
getUid: () => null,
addAuthTokenListener: (listener) => {
addAuthTokenListener: listener => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see why we need this change, but if it's an auto-formatting or linter thing, then you have my approval.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, this is from auto-formatting.

Copy link
Contributor

@wilhuff wilhuff left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

packages/firestore/CHANGELOG.md Outdated Show resolved Hide resolved
@wilhuff wilhuff assigned wu-hui and unassigned wilhuff Feb 12, 2020
@wu-hui wu-hui merged commit 2af214a into master Feb 13, 2020
@firebase firebase locked and limited conversation to collaborators Mar 15, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants