-
Notifications
You must be signed in to change notification settings - Fork 61
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
Codegen EntitySelectionTree + MergedSelections Refactor + Perf Improvments #152
Conversation
…ragments WIP: See entityStorage move Stash SortedSelections.swift for next steps
# Conflicts: # apollo-ios-codegen/Sources/IR/IR+DirectSelections.swift # apollo-ios-codegen/Sources/IR/IR+EntitySelectionTree.swift # apollo-ios-codegen/Sources/IR/IR+RootFieldBuilder.swift
…-merge-fragment-ref
…-merge-fragment-ref
✅ Deploy Preview for eclectic-pie-88a2ba ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
Looking forward to this one |
@pm-dev. This is the foundational refactoring needed to enable disabling of fragment field merging. That will finally get us to a point where the codegen will work on your project! |
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.
Great improvements here, thank you!
Co-authored-by: Calvin Cestari <[email protected]> Co-authored-by: gh-action-runner <[email protected]> Co-authored-by: gh-action-runner <[email protected]> Co-authored-by: gh-action-runner <[email protected]> Co-authored-by: Jeff Auriemma <[email protected]> Co-authored-by: gh-action-runner <[email protected]> Co-authored-by: Zach FettersMoore <[email protected]> Co-authored-by: SecOps[bot] <[email protected]> Co-authored-by: gh-action-runner <[email protected]> Co-authored-by: gh-action-runner <[email protected]>
2457cb65 Codegen EntitySelectionTree + MergedSelections Refactor + Perf Improvments (#152) git-subtree-dir: apollo-ios-codegen git-subtree-split: 2457cb659273c7938a4a757f5676b216c5f4d720
…ergedSelections Refactor + Perf Improvments git-subtree-dir: apollo-ios-codegen git-subtree-mainline: 8b2eb70 git-subtree-split: 2457cb659273c7938a4a757f5676b216c5f4d720
This PR does a number of things to refactor the Codegen engine in preparation for the disabling of merged fragment fields and improve the performance of the Codegen engine.
EntitySelectionTree
now computes the merged fields from merged fragments as needed when the merged fields are calculated, rather than when the fragment is initially merged in.RootFieldEntityStorage
renamed toDefinitionEntityStorage
and attached to definition.EntitySelectionTree
algorithm requires the entity storage at the time of calculation merged fields (since we are no longer merging the fragments and creating new entities when merging the selections in)IR.Definition
refactored from anenum
to aprotocol
.IR.SelectionSet
RootFieldBuilder
logic.merged
selections to newComputedSelectionSet
lazy var
onSelectionSet
was convenient for use, but it meant they were retained for the entire time theSelectionSet
was in memory. SinceIR.Operation
andIR.NamedFragment
retain theirrootField
these were being retained for the entire execution of codegen.ComputedSelectionSet
, which now computes and stores the merged selections, is created as needed in theSelectionSetTemplate
using the newComputedSelectionSet.Builder
. These computed selection sets can be used when needed to render the selection set templates and then be released. This should improve memory consumption greatly.SelectionSet
, rather than generating its own child selection set with the same exact shape.IR.SelectionSet
, which stays in memory for the entirety of execution.typealias
pointing to the correct fully qualified name of the referenced fragment instead of generating the selection set.IRTestWrapper
classes inApolloCodegenInternalTestHelpers
.ComputedSelectionSet
for each nested child entity.IRTestWrapper
instances wrap the existingIR
objects. The subscripts for testing are now provided by theIRTestWrapper
, which handle the computation of merged fields internally as they are accessed.TODO:
SelectionSetTemplate
when theComputedSelectionSet
has been built.)IRTestWrapper
to store theComputedSelectionSet
for reuse during a single test run.After this PR is completed, the work to create the configuration options for disabling merged fragment fields will be unlocked.