René's URL Explorer Experiment


Title: Reduce SDL checking, directive construction, and schema traversal work by andimarek · Pull Request #4535 · graphql-java/graphql-java · GitHub

Open Graph Title: Reduce SDL checking, directive construction, and schema traversal work by andimarek · Pull Request #4535 · graphql-java/graphql-java

X Title: Reduce SDL checking, directive construction, and schema traversal work by andimarek · Pull Request #4535 · graphql-java/graphql-java

Description: This PR reduces SDL checking, directive construction and shared traversal work during schema generation. The direct IDL follow-up below affects both SchemaGenerator and FastSchemaGenerator through the checker and construction helpers they call. Direct SDL checking and construction changes Change Previous work New behavior SchemaTypeChecker.checkFieldTypesPresent Copied field types into a list and built nested argument-type lists before flattening them. Visits the existing fields and arguments directly, in two passes that retain the existing error order. SchemaTypeChecker.checkNamedUniqueness Allocated a set for empty/single-item lists and performed separate membership and insertion lookups. Returns immediately for fewer than two entries and uses the result of Set.add to identify duplicates. ImplementingTypesChecker Built a field set/map even when no interfaces were implemented; printed both argument-type ASTs to compare them. Skips the field map after resolving an empty interface set, and compares type names/list/non-null wrappers directly. AST printing remains on error-reporting paths. SchemaTypeDirectivesChecker Rebuilt a directive's allowed-argument map for every use. Reuses that map within one checker instance. Supplied values are still validated independently at each use. SchemaGeneratorHelper.BuildContext Scanned the runtime directive-definition set for each applied directive. Maintains a per-build name index, preserving first-definition lookup behavior and the existing AST fallback for forward definitions. SchemaGeneratorAppliedDirectiveHelper Built two supplied-argument maps and four temporary argument lists/copies while constructing legacy and applied directives. Inserts supplied arguments into the builders directly, shares one supplied-name set while adding missing/default arguments, and skips output-list allocation for empty directive lists. TypeDefinitionRegistry is unchanged in this follow-up: the existing registry improvements are already in the baseline, and the profiles supported the checker and directive-construction changes above. Final incremental mean time reduction versus follow-up baseline baf539554 (the previous PR plus master 96443c271; the same master correctness fixes are present in both variants). Positive means less time; negative means more: Fixture SchemaGenerator: generation Fast: generation SchemaGenerator: parse + generation Fast: parse + generation 1 +16.94% +25.77% +10.34% +15.64% 2 +26.64% +43.04% +19.70% +26.15% 3 +2.51% +7.18% -0.23% +3.15% 4 +2.08% +8.25% +2.94% +4.49% 5 +3.49% +4.63% +1.18% +3.07% Allocation per operation is lower in all 20 cases, by 1.62-61.84%. Time means are lower in 19/20. SchemaGenerator parsing fixture 3 is 0.23% slower, with overlapping fork means and JMH intervals; no time gain is claimed for that case. Timing intervals also overlap for SchemaGenerator fixture 4 in both scopes and all fixture 5 cases. Those small gains are observed means, not separately established significant improvements. The two change groups were measured independently before the final comparison: Exploratory comparison Lower time means Range of time reduction Lower allocation means SDL checker group A versus baseline 18/20 -4.76% to +42.96% 16/20 Directive construction B2 versus A 16/20 -2.12% to +4.93% 16/20 These one-fork comparisons attribute results to groups, not individual edits, and do not enter the final gains above. All ten Fast cases had lower time means in the directive experiment. Unfavorable exploratory cases are retained: notably A's SchemaGenerator fixture 5 slowdowns and B2's fixture 4/5 allocation increases versus A. Separate profiles and repeated forks showed allocation variation in unchanged traversal paths in both A and B2; JVM allocation elimination is a possible explanation, not proven causation. The final combined comparison has lower mean time/allocation in those cases, but does not independently disprove every unfavorable A-versus-B2 difference. Methodology: dedicated Ryzen 5 3600; Java 25 only, 24 GiB fixed heap, ZGC, compact object headers, adaptive GC workers. All five fixtures, both generators, both scopes: 20 timing cases, three forks/version/case, each with 10 x 10s warmup and 5 x 10s measurement. Version order alternates by case; runs are serial under a global lock. Nineteen separate async-profiler recordings used the same warmup and 3 x 10s measurement; their timing scores are excluded. All 120 final timing forks completed with zero allocation stalls. Two candidate warmup trends were inspected and retained (SG generation fixture 4 and parsing fixture 5, fork 3); their uncertainty is documented. Original governors and paused timer/service states were restored and verified after measurement. Correctness: 529 targeted IDL cases; full Java 25 ZGC/compact-header suite 6,146 passed, seven existing skips; all ten generated-schema hashes/type counts match baseline; Javadoc and the per-class coverage gate passed. Local totals include two unrelated untracked parser tests excluded from this PR. Spock tests cover error order, wrapper comparisons, extensions, malformed interfaces, directive defaults/nulls/unset values, both generators and options, ordering, forward definitions and build isolation. CI passed Java 17/21/25 tests and TestNG, jcstress, Javadoc, build checks, file validation, and the per-class coverage gate. Complete follow-up results, both exploratory tables, raw JMH/GC logs, profiles, limitations and reproduction. The follow-up measurements are incremental to a newer baseline. Keep them separate from the original results below; do not add or multiply percentages. Original shared traversal changes and results Both schema generators spend substantial time traversing schema elements and validating the resulting schema. This PR reduces allocation and repeated work in that shared code through four changes, developed over three profiling rounds: Create ancestor lists only when needed — DefaultTraverserContext. Previously, every traversal context copied its parent's complete ancestor list, even when the visitor never requested that list. Now it captures the parent breadcrumb and builds/caches the full immutable list on the first getBreadcrumbs() call. Traversals that do not need breadcrumbs avoid those list allocations and copies. Parent-node snapshots and custom context behavior are preserved. Create local variable maps only on the first write — TraverserState / DefaultTraverserContext. Previously, every non-root sequential traversal context allocated an empty LinkedHashMap. Now the map is allocated only when setVar() is called. Contexts that only read inherited state therefore need no local map; parent lookup and variable shadowing remain dynamic. Allocate the flattened child list at its final size — SchemaElementChildrenContainer.getChildrenAsList(). Previously, repeated addAll() calls grew the result array and created temporary arrays for child groups. Now the method sums the child counts, allocates the required capacity once, and appends children directly. This removes temporary arrays and growth copies while preserving order, duplicates, and an independent mutable result. Look up validation state only for nodes with directives — AppliedDirectivesAreValid. Previously, every visited node searched its ancestor contexts for the schema and error collector before checking whether it had directives. Now that check happens first. Nodes without directives avoid both ancestor searches; nodes with directives receive the same validation checks. The JMH benchmarks now cover both generators, all five large schemas, and both generation-only and parsing-plus-generation, with schema validation enabled. Spock tests cover the behavior affected by these optimizations. Final mean time reduction versus master b88bb44f5 (already includes #4528): Fixture SchemaGenerator: generation Fast: generation SchemaGenerator: parse + generation Fast: parse + generation 1 7.75% 4.53% 5.53% 3.77% 2 6.26% 4.76% 4.27% 2.17% 3 12.01% 7.49% 7.46% 5.83% 4 15.87% 12.57% 10.66% 8.64% 5 21.54% 24.55% 16.91% 19.79% Allocation per operation falls 2.48–30.32%. The 2.17% Fast/fixture-2 parsing gain has overlapping variability; it is not claimed as independently significant. Measured serially on a dedicated Ryzen 5 3600 using Java 25, ZGC, compact headers, adaptive GC workers, and a 24 GiB heap. Final comparison: 3 forks/version/case, each with 10 × 10s warmup and 5 × 10s measurement, alternating version order. Profiling was separate. All 120 forks completed without allocation stalls; one warmup trend was inspected and documented. Original server settings were restored. Validation: 6,029 Spock cases passed (7 existing skips), all ten generator/fixture outputs match baseline, build/TCK checks passed, and the local per-class coverage gate reports no regressions. Local counts include two pre-existing parser tests excluded from this PR. CI also passed Java 17/21/25, jcstress, Javadoc, and the per-class coverage gate. Full results, raw JMH samples, profile evidence, caveats, and reproduction instructions.

Open Graph Description: This PR reduces SDL checking, directive construction and shared traversal work during schema generation. The direct IDL follow-up below affects both SchemaGenerator and FastSchemaGenerator through ...

X Description: This PR reduces SDL checking, directive construction and shared traversal work during schema generation. The direct IDL follow-up below affects both SchemaGenerator and FastSchemaGenerator through ...

Opengraph URL: https://github.com/graphql-java/graphql-java/pull/4535

X: @github

direct link

Domain: github.com

react-profiling0
react-import-mapreact,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322
route-pattern/:user_id/:repository/pull/:id/files(.:format)
route-controllerpull_requests
route-actionfiles
fetch-noncev2:71c36830-43df-2369-889d-db728384dfff
current-catalog-service-hashae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b
request-idA1CC:3A4875:1FF1D09:2A8326C:6B017C6E
html-safe-nonceef78d0c161e26996d7fbbe21dae241b7a153a68bae352967f7b2f327d950293e
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBMUNDOjNBNDg3NToxRkYxRDA5OjJBODMyNkM6NkIwMTdDNkUiLCJ2aXNpdG9yX2lkIjoiMTg1MjE3NDQ5NzUyNDg0MTU4MiIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmacc957fc127f8369b02f7548e8b16ed75ffa68f2a1ebae32354fbf36a256718649
hovercard-subject-tagpull_request:5145330552
github-keyboard-shortcutsrepository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///pull_requests/show/files
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/graphql-java/graphql-java/pull/4535/files
twitter:imagehttps://avatars.githubusercontent.com/u/1706744?s=400&v=4
twitter:cardsummary_large_image
og:imagehttps://avatars.githubusercontent.com/u/1706744?s=400&v=4
og:image:altThis PR reduces SDL checking, directive construction and shared traversal work during schema generation. The direct IDL follow-up below affects both SchemaGenerator and FastSchemaGenerator through ...
og:site_nameGitHub
og:typeobject
hostnamegithub.com
expected-hostnamegithub.com
Nonecc5dfdd32f62ebd3223cab3af3aa2b268d3605218237326a48a99d1efd89495c
turbo-cache-controlno-preview
diff-viewunified
go-importgithub.com/graphql-java/graphql-java git https://github.com/graphql-java/graphql-java.git
octolytics-dimension-user_id14289921
octolytics-dimension-user_logingraphql-java
octolytics-dimension-repository_id38602457
octolytics-dimension-repository_nwographql-java/graphql-java
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id38602457
octolytics-dimension-repository_network_root_nwographql-java/graphql-java
turbo-body-classeslogged-out env-production page-responsive full-width
disable-turbotrue
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release8c77c9e8439031ad54c75a250694842892f693e1
ui-targetcanary-1
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/graphql-java/graphql-java/pull/4535/files#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fgraphql-java%2Fgraphql-java%2Fpull%2F4535%2Ffiles
GitHubRepository hosting, code review, and collaborationhttps://github.com/platform
CopilotAI coding agent for tasks, projects, and automated workhttps://github.com/features/copilot
ActionsCI/CD and automationhttps://github.com/features/actions
Code QualityQuality analysis, fixes, and enforcementhttps://github.com/features/code-quality
CodespacesCloud development environmentshttps://github.com/features/codespaces
Code SecurityVulnerability detection and remediationhttps://github.com/security/advanced-security/code-security
Secret ProtectionSecret scanning and leak preventionhttps://github.com/security/advanced-security/secret-protection
All Featureshttps://github.com/features
Documentationhttps://docs.github.com/en
Traininghttps://learn.github.com/skills
Certificationshttps://learn.github.com/credentials
Build with Copilothttps://github.com/features/ai
Customize Copilothttps://docs.github.com/en/copilot/how-tos/copilot-on-github/customize-copilot/customize-copilot-overview
Integrationshttps://github.com/marketplace
Trending reposhttps://github.com/trending
GitHub Sponsorshttps://github.com/open-source/sponsors
Developer articleshttps://github.com/resources/articles
ChangelogYour source for the latest features, improvements, and fixes across GitHub products, all in one place.https://github.blog/changelog/
Enterpriseshttps://github.com/enterprise
Teamhttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
See all industrieshttps://github.com/solutions/industry
Why GitHubhttps://github.com/why-github
Customer Storieshttps://github.com/customer-stories
Business insightshttps://github.com/solutions/executive-insights
Trust Centerhttps://github.com/trust-center
GitHub Advanced SecurityEnterprise-grade code securityhttps://github.com/security/advanced-security
Copilot for businessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Documentationhttps://docs.github.com/en
Resource centerhttps://github.com/resources
Bloghttps://github.blog/
Events & webinarshttps://github.com/resources/events
Community Forumhttps://github.com/orgs/community/discussions
Customer Storieshttps://github.com/customer-stories
Integrationshttps://github.com/marketplace
Customer supporthttps://help.github.com/
Traininghttps://learn.github.com/skills
GitHub Statushttps://www.githubstatus.com/
Abouthttps://github.com/about
Partnershttps://github.com/partners
Changeloghttps://github.blog/changelog/
GitHub UniverseThe event for developers, by developers — talks, workshops, and what’s next for GitHub.https://githubuniverse.com/
Pricinghttps://github.com/pricing
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fgraphql-java%2Fgraphql-java%2Fpull%2F4535%2Ffiles
Sign uphttps://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fpull_requests%2Fshow%2Ffiles&source=header-repo&source_repo=graphql-java%2Fgraphql-java
Reloadhttps://github.com/graphql-java/graphql-java/pull/4535/files
Reloadhttps://github.com/graphql-java/graphql-java/pull/4535/files
Reloadhttps://github.com/graphql-java/graphql-java/pull/4535/files
graphql-javahttps://github.com/graphql-java
graphql-javahttps://github.com/graphql-java/graphql-java
Codehttps://github.com/graphql-java/graphql-java
Issues27 (27)https://github.com/graphql-java/graphql-java/issues
Pull requests35 (35)https://github.com/graphql-java/graphql-java/pulls
Discussionshttps://github.com/graphql-java/graphql-java/discussions
Actionshttps://github.com/graphql-java/graphql-java/actions
Projectshttps://github.com/graphql-java/graphql-java/projects
Wikihttps://github.com/graphql-java/graphql-java/wiki
Security and qualityhttps://github.com/graphql-java/graphql-java/security
Insightshttps://github.com/graphql-java/graphql-java/insights
Sign up for GitHub https://github.com/signup?return_to=%2Fgraphql-java%2Fgraphql-java%2Fissues%2Fnew%2Fchoose
terms of servicehttps://docs.github.com/terms
privacy statementhttps://docs.github.com/privacy
Sign inhttps://github.com/login?return_to=%2Fgraphql-java%2Fgraphql-java%2Fissues%2Fnew%2Fchoose
andimarekhttps://github.com/andimarek
masterhttps://github.com/graphql-java/graphql-java/tree/master
codex/large-schema-generation-performancehttps://github.com/graphql-java/graphql-java/tree/codex/large-schema-generation-performance
Conversation 4 https://github.com/graphql-java/graphql-java/pull/4535
Commits 11 https://github.com/graphql-java/graphql-java/pull/4535/commits
Checks 10 https://github.com/graphql-java/graphql-java/pull/4535/checks
Files changed https://github.com/graphql-java/graphql-java/pull/4535/files
Please reload this pagehttps://github.com/graphql-java/graphql-java/pull/4535/files
Reduce SDL checking, directive construction, and schema traversal work https://github.com/graphql-java/graphql-java/pull/4535/files#top
Show all changes 11 commits https://github.com/graphql-java/graphql-java/pull/4535/files
ca944d6 Benchmark both schema generators across all five large schemas andimarek Nov 3, 2026 https://github.com/graphql-java/graphql-java/pull/4535/commits/ca944d6c1e1c53008d3448c314feca1e5d8e5a6f
86c4cf2 Build traversal breadcrumb lists only when requested andimarek Nov 3, 2026 https://github.com/graphql-java/graphql-java/pull/4535/commits/86c4cf21a72442126de826ba5890a19d319ef9aa
d124421 Allocate traversal context variables only when first written andimarek Nov 3, 2026 https://github.com/graphql-java/graphql-java/pull/4535/commits/d12442110ac2231c894de23ad93ac7add2a71392
f32f89b Reduce schema child copying and unnecessary validation lookups andimarek Nov 3, 2026 https://github.com/graphql-java/graphql-java/pull/4535/commits/f32f89bd7899eacc7a607972d7be86b0f3f704ff
9714171 Document schema generation benchmarks and reproducible performance ev… andimarek Nov 3, 2026 https://github.com/graphql-java/graphql-java/pull/4535/commits/971417159c13f9f88d4542443c18d33a40b01421
baf5395 Merge remote-tracking branch 'origin/master' into codex/large-schema-… andimarek Nov 5, 2026 https://github.com/graphql-java/graphql-java/pull/4535/commits/baf539554c9092ea8434cbced868a40d545a736b
8117620 Reduce allocation and repeated work in SDL validation andimarek Nov 5, 2026 https://github.com/graphql-java/graphql-java/pull/4535/commits/81176201b2ad71ee75a236f4d59eead05417988c
ffc2628 Reduce directive construction allocation during schema generation andimarek Nov 5, 2026 https://github.com/graphql-java/graphql-java/pull/4535/commits/ffc2628881ed533e06446571471807da38526938
8025109 Remove obsolete directive storage and cover malformed interface defin… andimarek Nov 5, 2026 https://github.com/graphql-java/graphql-java/pull/4535/commits/802510928a2f4baf1918b9e36c21c160ae3d5b14
608095d Document direct SDL performance experiments and final comparison andimarek Nov 6, 2026 https://github.com/graphql-java/graphql-java/pull/4535/commits/608095d51870ce3d0a2a6add7a5dace108cffdbc
2fbb3b8 Merge origin/master into schema generation performance branch andimarek Nov 13, 2026 https://github.com/graphql-java/graphql-java/pull/4535/commits/2fbb3b865a7eca6f0b0de656c4c39cb4b0de0580
Clear filters https://github.com/graphql-java/graphql-java/pull/4535/files
Please reload this pagehttps://github.com/graphql-java/graphql-java/pull/4535/files
Please reload this pagehttps://github.com/graphql-java/graphql-java/pull/4535/files
performance-results/schema-generation-java25/README.mdhttps://github.com/graphql-java/graphql-java/pull/4535/files#diff-2c9c918f33792fac1e8f53ed799f79f47a62a1b49f54fd3eeace56efe9367727
View file https://github.com/graphql-java/graphql-java/blob/2fbb3b865a7eca6f0b0de656c4c39cb4b0de0580/performance-results/schema-generation-java25/README.md
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/graphql-java/graphql-java/pull/4535/{{ revealButtonHref }}
Please reload this pagehttps://github.com/graphql-java/graphql-java/pull/4535/files
Please reload this pagehttps://github.com/graphql-java/graphql-java/pull/4535/files
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.