dotansimha / dotansimha/graphql-code-generator

Performance optimizations: caching

Open
#9,895 0 comments 18 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
11.3k
Forks
1.4k
Avg merge
1d 1h
Merged PRs (30d)
23

Description

### 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_

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.