This repository has been archived by the owner on Dec 8, 2021. It is now read-only.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I thought I'd open this PR for discussion.
Currently, running
graphqlgen
on a project with a large schema is very slow. For example, runninggraphqlgen
on my project with a ~20,000 line schema takes over 2 minutes to complete.I decided to do some quick profiling to figure out what was taking so long. To do this, I forked and cloned this repo, and then:
packages/graphqlgen
, runyarn build
node --inspect PATH_TO_GRAPHQLGEN_DIST_INDEX_JS
Here's the result:
To my surprise, formatting the code in
generateTypes
was taking the vast majority of the time.So, I decided to try disabling formatting the code in
generateTypes
. Here's the result after applying the diff and following the same steps from above:This took ~4500 ms instead of ~160,000 ms, a vast improvement.
However, I doubt most projects have this large of a schema, and a formatted
graphqlgen.ts
is undeniably nicer to look at. Thoughts?.zip of the
.cpuprofile
s: Archive.zip