Repository navigation
Conversation
Contributor
Test ReportTest Results
Code Coverage (Java 25)
Changed Class Coverage (4 classes)
|
bbakerman
approved these changes
Nov 4, 2026
This branch has not been deployed
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.
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 firstgetBreadcrumbs()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 emptyLinkedHashMap. Now the map is allocated only whensetVar()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, repeatedaddAll()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):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.