apollo-ios
                                
                                
                                
                                    apollo-ios copied to clipboard
                            
                            
                            
                        [Codegen] Codegen fails to finish with many nested fragments
Summary
When running codegen on a large project with many operations with nested fragments, codegen hangs and never finishes. We were hoping the disable fragment merging feature would solve this, sadly it does not.
In an email exchange with @AnthonyMDev it sounded like this is a known issue:
This is also a known issue. It’s pretty rare, but some users with a LOT of nested fragments, we’re seeing this issue currently.
It’s due to the collections that hold all the computed merged fragment fields being so large that they are causing these issues. My current hypothesis is that the performance problem is mostly seen when the collection exceeds its capacity and is copied into a larger buffer.
I’ve been dealing with other issues, so I haven’t gotten around to this one yet, but my thought is that I can replace the array with a more suitable data structure. I think a custom tree implementation is going to be able to resolve it. Once I get the fragment merging resolved, I’ll try to work on that...
Wanted to open an issue so we can track it and prioritize it! Thanks, looking forward to finally adopting v1!
Version
1.0
Steps to reproduce the behavior
I've previously submitted a schema and .graphql operation files that allow reproducing this. Happy to send it again.
Logs
No response
Anything else?
No response