Avoid rendering client projections during merge - #959
Merged
Merged
Conversation
iuliiasobolevska
requested review from
asibross,
iparadiso,
jjacobs44,
kilink,
kzwang,
paulbakker and
srinivasankavitha
as code owners
September 21, 2026 16:04
paulbakker
approved these changes
Sep 21, 2026
jiholee17
approved these changes
Sep 22, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
JavaFile.hashCode()rendering complete source files during every accumulator mergeWhat was repeated
The projections were not being regenerated or rewritten to disk on every merge. Each projection already existed as an in-memory
JavaFile, but the old.distinct()call invokedJavaFile.hashCode(), which renders the complete Java source. Because results are merged incrementally, every merge rendered all previously accumulated projections again solely to deduplicate them.This change identifies a generated file by
(packageName, typeName)instead. That pair determines its output path, so deduplication no longer needs to render the source. The first projection for an identity still wins, and equal simple names in different packages remain distinct.Performance
An isolated CLI benchmark against the same 3.7 MB consumer schema measured a median of 113.61 seconds on
masterand 5.39 seconds with this change for 9,000 generated files—a 21x reduction. The two 57 MB output trees were identical; all 5,253 generated client files were byte-for-byte unchanged.The focused regression exceeded its five-second bound before the change and passes after it.
This removes the dominant repeated source-rendering cost. The merge still performs repeated list concatenation and
distinctByscans; changing the accumulator shape is separate follow-up work.Verification
:graphql-dgs-codegen-core:testpassed