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

   Validates beans from plans precomputed per bean and group strategy, instead 
of recomputing what to validate on every call.
   
   - **Constraints per group strategy:** each element descriptor caches the 
constraints that match a strategy, instead of streaming over all of them for 
every value. Lookups first match recently seen strategy instances by identity 
(`GroupStrategyMap`), since validation keeps passing the same ones.
   - **Relevant properties only:** the `Default` group redefinition is cached 
per bean, along with the properties that need a frame for a strategy 
(constraints in scope, cascaded, or with constrained container elements). 
Properties with nothing to validate are no longer read at all.
   - **Lazy property frames:** frames are created on first use per group, so 
properties relevant only to groups that are never reached (e.g. later steps of 
a failing group sequence) are neither read nor resolved.
   - **One plan lookup:** the local group strategy and the relevant properties 
come from a single cached plan, and single-group strategies are validated 
directly instead of through `GroupStrategy#applyTo` callbacks.
   
   This is the largest step in the stack: 
`Jsr303Benchmark.bvalConstraintsSuccess` 14×, `mixedDrivers` 7×, 
`explicitGroup` 6×, `cascadedCycles`/`cascadedList` 5–6×, `classLevel*` 3.8×, 
`deepGraph` 3.6×. Allocation drops 30–85% across scenarios.
   
   ### Benchmarks (vs. #273)
   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) | 0.95 ± 66% | 5.52 ± 74% | **5.79×** | 1,098,127 
→ 443,567 |
   | cascadedList (ops/ms) | 0.29 ± 82% | 1.57 ± 23% | **5.42×** | 5,269,994 → 
2,043,592 |
   | classLevelInvalid (ops/ms) | 729 ± 96% | 2,780 ± 53% | **3.81×** | 3,256 → 
1,232 |
   | classLevelValid (ops/ms) | 1,332 ± 11% | 5,027 ± 34% | **3.77×** | 2,592 → 
568 |
   | composedInvalid (ops/ms) | 1,192 ± 9% | 2,016 ± 97% | **1.69×** | 2,532 → 
1,232 |
   | composedValid (ops/ms) | 951 ± 38% | 2,832 ± 83% | **2.98×** | 2,152 → 800 
|
   | containerElements (ops/ms) | 1.92 ± 9% | 4.99 ± 80% | **2.59×** | 
1,371,279 → 391,370 |
   | deepGraph (ops/ms) | 97.0 ± 46% | 345 ± 45% | **3.56×** | 23,154 → 4,008 |
   | elMessage (ops/ms) | 836 ± 45% | 1,154 ± 44% | **1.38×** | 3,412 → 2,088 |
   | executableParameters (ops/ms) | 422 ± 87% | 564 ± 52% | **1.34×** | 5,423 
→ 3,689 |
   | executableReturnValue (ops/ms) | 338 ± 46% | 1,258 ± 60% | **3.72×** | 
5,460 → 1,817 |
   | explicitGroup (ops/ms) | 703 ± 32% | 4,462 ± 53% | **6.34×** | 4,084 → 698 
|
   | mixedDrivers (ops/ms) | 507 ± 62% | 3,588 ± 4% | **7.07×** | 4,332 → 1,041 
|
   | validateProperty (ops/ms) | 1,615 ± 27% | 2,983 ± 10% | **1.85×** | 1,764 
→ 1,316 |
   | validateValue (ops/ms) | 3,477 ± 10% | 6,487 ± 9% | **1.87×** | 1,088 → 
648 |
   | wideBeanInvalid (ops/ms) | 80.6 ± 150% | 267 ± 11% | **3.31×** | 20,600 → 
9,568 |
   | wideBeanValid (ops/ms) | 120 ± 68% | 825 ± 10% | **6.88×** | 13,737 → 
2,816 |
   | Jsr303Benchmark.bvalBootstrapAndValidate (ops/s) | 1,523 ± 43% | 2,880 ± 
56% | **1.89×** | 251,542 → 247,317 |
   | Jsr303Benchmark.bvalBuildFactory (ops/s) | 7,148 ± 34% | 11,763 ± 3% | 
**1.65×** | 88,164 → 88,397 |
   | Jsr303Benchmark.bvalConstraintsFailure (ops/s) | 412,829 ± 89% | 3,370,311 
± 10% | **8.16×** | 4,236 → 1,352 |
   | Jsr303Benchmark.bvalConstraintsFailureReuseValidator (ops/s) | 458,567 ± 
38% | 2,876,706 ± 16% | **6.27×** | 4,248 → 1,376 |
   | Jsr303Benchmark.bvalConstraintsSuccess (ops/s) | 930,692 ± 50% | 
13,015,631 ± 35% | **13.98×** | 3,032 → 432 |
   | Jsr303Benchmark.bvalConstraintsSuccessReuseValidator (ops/s) | 575,500 ± 
101% | 13,263,502 ± 19% | **23.05×** | 2,900 → 432 |
   | Jsr303Benchmark.bvalNoConstraints (ops/s) | 132,245,313 ± 93% | 
167,339,787 ± 11% | **1.27×** | 0 → 0 |
   | Jsr303Benchmark.bvalNoConstraintsReuseValidator (ops/s) | 160,105,673 ± 
54% | 187,581,916 ± 24% | **1.17×** | 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