Index TypeUtils schema name lookups - #965
Merged
Merged
Conversation
iuliiasobolevska
requested review from
asibross,
iparadiso,
jjacobs44,
kilink,
kzwang,
paulbakker and
srinivasankavitha
as code owners
September 23, 2026 05:54
jiholee17
approved these changes
Sep 23, 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
Replace the remaining per-field schema scans in Java
TypeUtilswith lookups against the document-scopedSchemaIndex.The indexed lookups cover:
The public
TypeUtilsconstructor that accepts aDocumentremains unchanged.Relationship to #962
#962 introduced
SchemaIndex, built its document-order-preservingdefinitionsByNamemap once, and shared that index through the generator graph.Its PR description explicitly left the residual per-field scans in
TypeUtilsfor a separate optimization.This PR is that follow-up.
It preserves #962's
definitionsByNameimplementation and adds type-kind predicates that inspect onlydefinitions(name), reusing the existing map instead of scanning every document definition or building a competing index.Performance
The real
ot-occommon-dgsconsumer benchmark at commit8ce1311dgenerated 9,015 files and measured:7100dae0)The nominal median improvement is 4.0%.
Because the ranges overlap, this is directional evidence rather than a claim of a stable 4% speedup.
Every run produced the same 41,058,296 bytes across the same 9,015 paths with complete-tree SHA-256
cb765785686ac0f9d6c709cbc00ab3d635899e5932e5db361cd56fbc195132f3.Correctness safeguards
FooandIFoo.DateandPageInfoshadowing of built-in mappings.Verification
./gradlew :graphql-dgs-codegen-core:test :graphql-dgs-codegen-core:integTest :graphql-dgs-codegen-core:lintKotlinMain :graphql-dgs-codegen-core:lintKotlinTest --no-scan