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

   Removes the remaining overhead in cascading, container elements and 
executable validation.
   
   - **Container elements:** each element's leaf container element descriptors 
are precomputed as a flat array. The runtime container key is cached per 
container class, instead of resolving type arguments reflectively for every 
cascaded container. Extracted values are collected without a `Lazy` holder.
   - **Ancestor lookup:** the ancestor of a cascaded container element is found 
by comparing paths in place, without materializing the element's path.
   - **Cascading:** single-group strategies without group conversions are 
cascaded directly, and container elements are cascaded without a capturing 
lambda per value.
   - **Executables:** descriptors are cached per `Executable` instead of 
hashing a new `Signature` twice per call. The executable's base path and the 
bean's `Default` group redefinition are reused, parameter frames are created 
without streams, default parameter names are cached, and wrapper types map to 
primitives with a lookup instead of a scan.
   
   Biggest effects: `executableParameters` 3.8×, `cascadedCycles` 3.2×, 
`cascadedList` 2.8×, `deepGraph` 2.5×, `containerElements` 2.3×, 
`executableReturnValue` 1.8×. A few rows (`wideBeanInvalid`, `elMessage`) are 
lower in this run with unchanged allocation, which points to noise.
   
   ### Benchmarks (vs. #274)
   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) | 5.52 ± 74% | 17.5 ± 13% | **3.16×** | 443,567 → 
214,013 |
   | cascadedList (ops/ms) | 1.57 ± 23% | 4.36 ± 10% | **2.78×** | 2,043,592 → 
882,730 |
   | classLevelInvalid (ops/ms) | 2,780 ± 53% | 3,123 ± 21% | **1.12×** | 1,232 
→ 1,232 |
   | classLevelValid (ops/ms) | 5,027 ± 34% | 6,903 ± 22% | **1.37×** | 568 → 
568 |
   | composedInvalid (ops/ms) | 2,016 ± 97% | 2,729 ± 33% | **1.35×** | 1,232 → 
1,232 |
   | composedValid (ops/ms) | 2,832 ± 83% | 3,925 ± 43% | **1.39×** | 800 → 852 
|
   | containerElements (ops/ms) | 4.99 ± 80% | 11.4 ± 27% | **2.29×** | 391,370 
→ 283,097 |
   | deepGraph (ops/ms) | 345 ± 45% | 850 ± 55% | **2.46×** | 4,008 → 3,360 |
   | elMessage (ops/ms) | 1,154 ± 44% | 1,009 ± 28% | **0.87×** | 2,088 → 2,096 
|
   | executableParameters (ops/ms) | 564 ± 52% | 2,125 ± 11% | **3.77×** | 
3,689 → 1,717 |
   | executableReturnValue (ops/ms) | 1,258 ± 60% | 2,226 ± 23% | **1.77×** | 
1,817 → 1,401 |
   | explicitGroup (ops/ms) | 4,462 ± 53% | 5,199 ± 11% | **1.17×** | 698 → 698 
|
   | mixedDrivers (ops/ms) | 3,588 ± 4% | 3,530 ± 9% | **0.98×** | 1,041 → 
1,041 |
   | validateProperty (ops/ms) | 2,983 ± 10% | 3,009 ± 5% | **1.01×** | 1,316 → 
1,292 |
   | validateValue (ops/ms) | 6,487 ± 9% | 5,899 ± 27% | **0.91×** | 648 → 636 |
   | wideBeanInvalid (ops/ms) | 267 ± 11% | 197 ± 88% | **0.74×** | 9,568 → 
9,528 |
   | wideBeanValid (ops/ms) | 825 ± 10% | 720 ± 17% | **0.87×** | 2,816 → 2,816 
|
   | Jsr303Benchmark.bvalBootstrapAndValidate (ops/s) | 2,880 ± 56% | 2,284 ± 
51% | **0.79×** | 247,317 → 248,388 |
   | Jsr303Benchmark.bvalBuildFactory (ops/s) | 11,763 ± 3% | 11,070 ± 12% | 
**0.94×** | 88,397 → 88,753 |
   | Jsr303Benchmark.bvalConstraintsFailure (ops/s) | 3,370,311 ± 10% | 
2,849,765 ± 20% | **0.85×** | 1,352 → 1,352 |
   | Jsr303Benchmark.bvalConstraintsFailureReuseValidator (ops/s) | 2,876,706 ± 
16% | 3,121,360 ± 4% | **1.09×** | 1,376 → 1,384 |
   | Jsr303Benchmark.bvalConstraintsSuccess (ops/s) | 13,015,631 ± 35% | 
12,273,725 ± 29% | **0.94×** | 432 → 432 |
   | Jsr303Benchmark.bvalConstraintsSuccessReuseValidator (ops/s) | 13,263,502 
± 19% | 14,058,074 ± 9% | **1.06×** | 432 → 432 |
   | Jsr303Benchmark.bvalNoConstraints (ops/s) | 167,339,787 ± 11% | 
158,038,315 ± 11% | **0.94×** | 0 → 0 |
   | Jsr303Benchmark.bvalNoConstraintsReuseValidator (ops/s) | 187,581,916 ± 
24% | 186,538,080 ± 12% | **0.99×** | 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