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

Remove redundant iteration in EntitySelectionTree merging algorithm #308

Conversation

AnthonyMDev
Copy link
Contributor

@AnthonyMDev AnthonyMDev commented Mar 22, 2024

TL;DR

This PR refactors the EntitySelectionTree in apollo-ios-codegen.

What changed?

The conditions for merging selections were revisited. The use of scopeConditions was removed from the part of the code where the node's scope is checked if it is deferred. Instead, the condition to add merged inline fragments was moved under the child case, specifically when the child case is selections.

How to test?

Unit tests pass

Why make this change?

This is a significant performance improvement as it removes an entire additional iteration through all the conditional scopes in the tree.


Copy link

netlify bot commented Mar 22, 2024

Deploy Preview for apollo-ios-docc canceled.

Name Link
🔨 Latest commit e976b8e
🔍 Latest deploy log https://app.netlify.com/sites/apollo-ios-docc/deploys/65fcdc2a4fd0820008c42805

Copy link

netlify bot commented Mar 22, 2024

Deploy Preview for eclectic-pie-88a2ba canceled.

Name Link
🔨 Latest commit e976b8e
🔍 Latest deploy log https://app.netlify.com/sites/eclectic-pie-88a2ba/deploys/65fcdc2a2c1e63000858fd8a

Copy link
Member

@calvincestari calvincestari left a comment

Choose a reason for hiding this comment

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

This is a great find, thank you!

@calvincestari calvincestari merged commit a8fcb77 into main Mar 22, 2024
26 checks passed
@calvincestari calvincestari deleted the Remove_redundant_iteration_in_EntitySelectionTree_merging_algorithm branch March 22, 2024 18:10
BobaFetters pushed a commit to apollographql/apollo-ios-codegen that referenced this pull request Mar 22, 2024
BobaFetters pushed a commit that referenced this pull request Mar 22, 2024
02ac68ac Remove redundant iteration in EntitySelectionTree merging algorithm (#308)

git-subtree-dir: apollo-ios-codegen
git-subtree-split: 02ac68ac01a88082b69d307a18274b28431fe9c5
BobaFetters pushed a commit that referenced this pull request Mar 22, 2024
…ntitySelectionTree merging algorithm

git-subtree-dir: apollo-ios-codegen
git-subtree-mainline: 547a4f0
git-subtree-split: 02ac68ac01a88082b69d307a18274b28431fe9c5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants