[ 
https://issues.apache.org/jira/browse/GROOVY-12258?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18104768#comment-18104768
 ] 

ASF GitHub Bot commented on GROOVY-12258:
-----------------------------------------

codecov-commenter commented on PR #2785:
URL: https://github.com/apache/groovy/pull/2785#issuecomment-5292730845

   ## 
[Codecov](https://app.codecov.io/gh/apache/groovy/pull/2785?dropdown=coverage&src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
 Report
   :x: Patch coverage is `50.00000%` with `2 lines` in your changes missing 
coverage. Please review.
   :white_check_mark: Project coverage is 70.1124%. Comparing base 
([`ad907ac`](https://app.codecov.io/gh/apache/groovy/commit/ad907ac2ac33e6c1382fcf0aa9904170adf20509?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache))
 to head 
([`5013c5f`](https://app.codecov.io/gh/apache/groovy/commit/5013c5f647a87adef60fd874622ff60090483714?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)).
   :warning: Report is 1 commits behind head on master.
   
   | [Files with missing 
lines](https://app.codecov.io/gh/apache/groovy/pull/2785?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
 | Patch % | Lines |
   |---|---|---|
   | 
[...g/apache/groovy/runtime/indy/IndyInvalidation.java](https://app.codecov.io/gh/apache/groovy/pull/2785?src=pr&el=tree&filepath=src%2Fmain%2Fjava%2Forg%2Fapache%2Fgroovy%2Fruntime%2Findy%2FIndyInvalidation.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2dyb292eS9ydW50aW1lL2luZHkvSW5keUludmFsaWRhdGlvbi5qYXZh)
 | 0.0000% | [1 Missing and 1 partial :warning: 
](https://app.codecov.io/gh/apache/groovy/pull/2785?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
 |
   
   <details><summary>Additional details and impacted files</summary>
   
   
   
   [![Impacted file tree 
graph](https://app.codecov.io/gh/apache/groovy/pull/2785/graphs/tree.svg?width=650&height=150&src=pr&token=1r45138NfQ&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)](https://app.codecov.io/gh/apache/groovy/pull/2785?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
   
   ```diff
   @@                Coverage Diff                 @@
   ##               master      #2785        +/-   ##
   ==================================================
   - Coverage     70.1168%   70.1124%   -0.0044%     
     Complexity      35772      35772                
   ==================================================
     Files            1561       1561                
     Lines          132362     132366         +4     
     Branches        24331      24331                
   ==================================================
   - Hits            92808      92805         -3     
   - Misses          31156      31160         +4     
   - Partials         8398       8401         +3     
   ```
   
   | [Files with missing 
lines](https://app.codecov.io/gh/apache/groovy/pull/2785?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
 | Coverage Δ | |
   |---|---|---|
   | 
[...he/groovy/runtime/indy/SwitchPointInvalidator.java](https://app.codecov.io/gh/apache/groovy/pull/2785?src=pr&el=tree&filepath=src%2Fmain%2Fjava%2Forg%2Fapache%2Fgroovy%2Fruntime%2Findy%2FSwitchPointInvalidator.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2dyb292eS9ydW50aW1lL2luZHkvU3dpdGNoUG9pbnRJbnZhbGlkYXRvci5qYXZh)
 | `100.0000% <100.0000%> (ø)` | |
   | 
[...g/apache/groovy/runtime/indy/IndyInvalidation.java](https://app.codecov.io/gh/apache/groovy/pull/2785?src=pr&el=tree&filepath=src%2Fmain%2Fjava%2Forg%2Fapache%2Fgroovy%2Fruntime%2Findy%2FIndyInvalidation.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2dyb292eS9ydW50aW1lL2luZHkvSW5keUludmFsaWRhdGlvbi5qYXZh)
 | `87.6106% <0.0000%> (-1.5786%)` | :arrow_down: |
   
   ... and [3 files with indirect coverage 
changes](https://app.codecov.io/gh/apache/groovy/pull/2785/indirect-changes?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
   </details>
   <details><summary> :rocket: New features to boost your workflow: </summary>
   
   - :snowflake: [Test 
Analytics](https://docs.codecov.com/docs/test-analytics): Detect flaky tests, 
report on failures, and find test suite problems.
   - :package: [JS Bundle 
Analysis](https://docs.codecov.com/docs/javascript-bundle-analysis): Save 
yourself from yourself by tracking and limiting bundle sizes in JS merges.
   </details>




> category/bulk invalidation walks all loaded classes even when no indy site 
> was ever linked
> ------------------------------------------------------------------------------------------
>
>                 Key: GROOVY-12258
>                 URL: https://issues.apache.org/jira/browse/GROOVY-12258
>             Project: Groovy
>          Issue Type: Improvement
>            Reporter: Paul King
>            Priority: Major
>
> GROOVY-12191 scoped indy SwitchPoint invalidation to per-MetaClass domains, a 
> large net win for indy dispatch (the Grails indy suite improved roughly 2x 
> geomean on the benchmark dashboard). One piece of collateral: process-wide 
> invalidation events now retire domains by walking every loaded class.
> h3. Problem
> {{GroovyCategorySupport.newScope()}} / {{endScope()}} call 
> {{VMPlugin.invalidateCallSites()}} unconditionally — the runtime cannot know 
> which bytecode flavour invoked it. Since GROOVY-12191 that lands in 
> {{IndyInvalidation.invalidateCategory()}} → {{retireAllLoadedDomains()}}, 
> which iterates {{ClassInfo.getAllClassInfo()}} — O(all loaded classes) — 
> *twice per {{use}} block* (enter and leave). Previously this invalidated a 
> single process-wide SwitchPoint.
> Classic (non-invokedynamic) bytecode never installs indy MOP guards, so a 
> classic-only process pays the walk for nothing. The benchmark dashboard shows 
> the cost from the 2026-08-01 run onwards: the grails classic 
> {{CategoryBench}} methods are 2.4–3.8x slower (e.g. {{categoryInLoop}} ~183 → 
> ~650 ms/op), with smaller knock-on effects (1.1–1.4x) on the metaclass-change 
> and dynamic-dispatch benches.
> h3. Proposed fix
> Add a process-global monotonic flag to {{SwitchPointInvalidator}}, set in 
> {{getSwitchPoint()}} *before* the CAS publishes a newly allocated 
> SwitchPoint, and skip {{retireAllLoadedDomains()}} when the flag has never 
> been set (covers {{invalidateCategory}}, {{invalidateBulk}} and 
> {{invalidateUnscoped}} in one place).
> Safety argument: every live SwitchPoint — MetaClass domains and ClassInfo 
> pending domains alike — is allocated through {{getSwitchPoint()}}, and the 
> flag write precedes publication. So a {{false}} read proves no guard chain 
> anywhere holds a SwitchPoint, i.e. the full walk would provably have 
> collected an empty batch; the skip is observationally identical. Races with 
> concurrent linking are no worse than the existing walk, which can equally 
> miss a domain allocated mid-walk; correctness there rests on link-time 
> selection reading the current category state, which is untouched. Stats 
> counters still increment, so observability semantics are unchanged.
> Indy processes are unaffected: the flag flips at the first indy link, after 
> which all paths behave exactly as today.
> h3. Measurements
> JMH classic mode ({{-Pindy=false -PbenchInclude=CategoryBench.categoryInLoop 
> :perf:jmh}}, 2 forks x 5 iterations, JDK 21):
> ||build||categoryInLoop||
> |master (unpatched)|365.9 ± 18.5 ms/op|
> |patched|59.9 ± 1.2 ms/op|
> ~6x, restoring (locally, better than) the pre-2026-08-01 level. The flag 
> empirically stays {{false}} for the whole classic run even though groovy.jar 
> itself contains indy-compiled Groovy code. All 
> {{org.apache.groovy.runtime.indy}} / GROOVY-12191 tests and the category 
> runtime tests pass.
> h3. Possible follow-up
> Mixed and indy processes still pay the O(loaded classes) walk on each 
> category enter/leave. A registry of invalidators currently holding a live 
> SwitchPoint would make bulk retirement O(live domains) and would subsume this 
> flag; that is left out of scope here.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to