jungm opened a new pull request, #273:
URL: https://github.com/apache/bval/pull/273

   Trims allocations on the per-constraint and per-violation paths.
   
   - **Paths:** `PathImpl` is backed by an `ArrayList` instead of a 
`LinkedList`. Violation and node hash codes are computed without varargs 
arrays. A violation's path is derived directly from the parent context instead 
of materializing the context's own path and copying it again.
   - **Traversable resolver:** `DefaultTraversableResolver` is skipped when JPA 
is not present. It can only answer yes in that case, and calling it costs the 
paths built for it. The exact-class check keeps subclasses honored.
   - **`@ReportAsSingleViolation`:** violations of the composing constraints 
are discarded anyway, so they are no longer built (path, message, hash code). 
Composing constraints are evaluated without a stream.
   
   Allocation per operation drops by up to 46% (`composedInvalid` 4,712 → 2,532 
B/op, `wideBeanInvalid` 28,157 → 20,600 B/op). Biggest throughput effect: 
`composedInvalid` 1.8×. Several throughput deltas in this run are within noise, 
e.g. `cascadedCycles` ±66% and 
`Jsr303Benchmark.bvalConstraintsSuccessReuseValidator`, even though their 
allocation went down.
   
   ### Benchmarks (vs. #272)
   Measured with JMH 1.37 on JDK 25 (`-p provider=bval -f 2 -wi 2 -i 3`, 1 s 
iterations, `-prof gc`) against the PR below this one in the stack. This was a 
busy desktop machine, so throughput carries large error bars (shown as ±). The 
allocation column (B/op) is deterministic and more reliable.
   
   | Benchmark | Before | After | Change | B/op before → after |
   |---|---:|---:|---:|---:|
   | cascadedCycles (ops/ms) | 2.42 ± 14% | 0.95 ± 66% | **0.39×** | 1,202,427 
→ 1,098,127 |
   | cascadedList (ops/ms) | 0.32 ± 33% | 0.29 ± 82% | **0.92×** | 5,778,430 → 
5,269,994 |
   | classLevelInvalid (ops/ms) | 516 ± 61% | 729 ± 96% | **1.41×** | 3,896 → 
3,256 |
   | classLevelValid (ops/ms) | 978 ± 68% | 1,332 ± 11% | **1.36×** | 3,040 → 
2,592 |
   | composedInvalid (ops/ms) | 669 ± 5% | 1,192 ± 9% | **1.78×** | 4,712 → 
2,532 |
   | composedValid (ops/ms) | 1,042 ± 5% | 951 ± 38% | **0.91×** | 2,976 → 
2,152 |
   | containerElements (ops/ms) | 1.84 ± 19% | 1.92 ± 9% | **1.04×** | 
1,623,248 → 1,371,279 |
   | deepGraph (ops/ms) | 87.9 ± 68% | 97.0 ± 46% | **1.10×** | 31,289 → 23,154 
|
   | elMessage (ops/ms) | 657 ± 99% | 836 ± 45% | **1.27×** | 3,840 → 3,412 |
   | executableParameters (ops/ms) | 532 ± 10% | 422 ± 87% | **0.79×** | 5,761 
→ 5,423 |
   | executableReturnValue (ops/ms) | 496 ± 12% | 338 ± 46% | **0.68×** | 6,255 
→ 5,460 |
   | explicitGroup (ops/ms) | 734 ± 11% | 703 ± 32% | **0.96×** | 4,930 → 4,084 
|
   | mixedDrivers (ops/ms) | 536 ± 27% | 507 ± 62% | **0.95×** | 5,422 → 4,332 |
   | validateProperty (ops/ms) | 2,026 ± 4% | 1,615 ± 27% | **0.80×** | 1,795 → 
1,764 |
   | validateValue (ops/ms) | 2,479 ± 45% | 3,477 ± 10% | **1.40×** | 1,070 → 
1,088 |
   | wideBeanInvalid (ops/ms) | 68.1 ± 44% | 80.6 ± 150% | **1.18×** | 28,157 → 
20,600 |
   | wideBeanValid (ops/ms) | 72.0 ± 92% | 120 ± 68% | **1.67×** | 17,308 → 
13,737 |
   | Jsr303Benchmark.bvalBootstrapAndValidate (ops/s) | 1,652 ± 61% | 1,523 ± 
43% | **0.92×** | 250,395 → 251,542 |
   | Jsr303Benchmark.bvalBuildFactory (ops/s) | 3,164 ± 43% | 7,148 ± 34% | 
**2.26×** | 89,026 → 88,164 |
   | Jsr303Benchmark.bvalConstraintsFailure (ops/s) | 471,733 ± 46% | 412,829 ± 
89% | **0.88×** | 5,000 → 4,236 |
   | Jsr303Benchmark.bvalConstraintsFailureReuseValidator (ops/s) | 514,364 ± 
60% | 458,567 ± 38% | **0.89×** | 5,048 → 4,248 |
   | Jsr303Benchmark.bvalConstraintsSuccess (ops/s) | 826,895 ± 91% | 930,692 ± 
50% | **1.13×** | 3,068 → 3,032 |
   | Jsr303Benchmark.bvalConstraintsSuccessReuseValidator (ops/s) | 1,133,176 ± 
70% | 575,500 ± 101% | **0.51×** | 3,080 → 2,900 |
   | Jsr303Benchmark.bvalNoConstraints (ops/s) | 159,318,160 ± 10% | 
132,245,313 ± 93% | **0.83×** | 0 → 0 |
   | Jsr303Benchmark.bvalNoConstraintsReuseValidator (ops/s) | 147,841,169 ± 
67% | 160,105,673 ± 54% | **1.08×** | 0 → 0 |
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to