Repository navigation
Conversation
…rargs - Back PathImpl with an ArrayList, which copies and indexes faster than a LinkedList for the short paths validation builds. - Compute violation and node hash codes without allocating a varargs array.
Build the private path copy handed to a violation from the parent's path instead of first materializing the context's own path and copying it again.
Without JPA, DefaultTraversableResolver reports every property as reachable and cascadable, so calling it only costs the paths built for it. The exact-class check keeps subclasses honored.
The violations of constraints composing one annotated with @ReportAsSingleViolation are discarded, so only whether they failed matters. Recognize the discarding sink and skip building their paths, messages and hash codes, and evaluate composing constraints without a stream.
jungm
force-pushed
the
perf-3-allocations
branch
from
October 5, 2026 11:43
4f9103a to
780244e
Compare
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
Trims allocations on the per-constraint and per-violation paths.
Evidence
Numbers are JMH throughput (
-p provider=bval -f 2 -wi 2 -i 3, 1 s iterations,-prof gc, JDK 25), measured against the PR below this one. The machine was busy, so throughput carries wide error bars; the bytes allocated per operation (B/op) are deterministic.All benchmarks
Several throughput rows (e.g.
cascadedCycles±66%) are within noise even though their allocation went down.Merge Danger
Door: two-way
Blast Radius: violation paths
TraversableResolver: custom resolvers, subclasses ofDefaultTraversableResolverand JPA environments are still consulted. Only the exact default class without JPA, which always answers yes, is skipped.