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

Performance optimizations: caching #9895

Open
benjie opened this issue Mar 8, 2024 · 0 comments
Open

Performance optimizations: caching #9895

benjie opened this issue Mar 8, 2024 · 0 comments

Comments

@benjie
Copy link
Contributor

benjie commented Mar 8, 2024

Is your feature request related to a problem? Please describe.

GraphQL Codegen is amazingly powerful, but performance can be lacklustre at times. This issue is to open a conversation about what could be done to improve performance.

Describe the solution you'd like

There are a number of optimizations that could be put in place when ran in watch mode; I'm not sure which of these are already implemented?

  • Files that have been parsed can be cached, and only re-parsed when the file watcher indicates they have changed
  • Detected GraphQL documents in a TypeScript file can be cached, and logic put in place such that when a file changes if the GraphQL within it has not changed then there's no action necessary for that file
  • Parsing of extracted GraphQL documents can be cached
  • Parsing of the GraphQL schema can be cached
  • Validation can be cached
  • Type generation itself could be cached so that only types related to the changed document(s) need to be regenerated
  • A comparison could be performed on the output versus the previous output so that files are only written if doing so would result in a concrete change, reducing overhead for TypeScript

Ultimately, it would be wonderful if adding a field to a GraphQL query in a large codebase could result in the generated code being output in under one second (ideally faster).

Describe alternatives you've considered

No response

Is your feature request related to a problem? Please describe.

No response

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

1 participant