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

defer/stream: use Set for subsequentPayloads #3717

Conversation

glasser
Copy link
Contributor

@glasser glasser commented Aug 24, 2022

As far as I can tell, the ordering of subsequentPayloads is not used for
anything, so this lets use convert the O(n) indexOf and splice
operations in yieldSubsequentPayloads to sublinear.

As far as I can tell, the ordering of subsequentPayloads is not used for
anything, so this lets use convert the O(n) indexOf and splice
operations in yieldSubsequentPayloads to sublinear.
@glasser
Copy link
Contributor Author

glasser commented Aug 24, 2022

cc @robrichard @IvanGoncharov

@github-actions
Copy link

Hi @glasser, I'm @github-actions bot happy to help you with this PR 👋

Supported commands

Please post this commands in separate comments and only one per comment:

  • @github-actions run-benchmark - Run benchmark comparing base and merge commits for this PR
  • @github-actions publish-pr-on-npm - Build package from this PR and publish it on NPM

@robrichard robrichard merged commit 857b440 into graphql:defer-stream Aug 24, 2022
@glasser
Copy link
Contributor Author

glasser commented Aug 24, 2022

Actually, since Set.forEach iterates in insertion order, my caveat about "the ordering of subsequentPayloads is not used for anything" isn't even relevant. Since all we ever did is push unique newly created items, forEach order should be identical between the array and the Set.

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