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

Fragments used in Fragments are leading to big source.body string #816

Open
marvinsemmelroth opened this issue Oct 25, 2024 · 1 comment
Milestone

Comments

@marvinsemmelroth
Copy link

Originally opened in graphql/graphql-js#4255 but the conclusion was that the implementation should happen here.

To recap:

The problem im facing is that when using graphql-tag im seeing huge memory chunks taken up by the query-strings (as far as 2.5mb) especially when using a lot of fragments.

The cause of this is this concat https://github.com/apollographql/graphql-tag/blob/main/src/index.ts#L125-L132 which will concat all used fragments into the to be parsed string which if you have alot of fragments result into a large string.

As proposed by @JoviDeCroock here I'd like to see the change that we reuse already declared definitions by merging them into the parsed document rather than parsing the definitions again (and again). In my local testing this would free up a lot of space both for the source and also for the docCache-Key and also should improve performance by just using the existing definitions rather than parsing them again.

@phryneas phryneas added this to the v3.0 milestone Oct 28, 2024
@phryneas
Copy link
Member

Hi @marvinsemmelroth, thanks for opening the issue.

On first glance, that looks reasonable. We will soon start working on a new major release for this package, and I'm putting this issue on the list to go over for that milestone :)

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

No branches or pull requests

2 participants