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

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

github-actions[bot] commented on PR #3280:
URL: https://github.com/apache/groovy/pull/3280#issuecomment-6729129793

   ### JMH summary — indy (commit `9baee5e`)
   
   Speedup vs trailing 90-day baseline on gh-pages. Higher = faster.
   `1.00` = in line with history. Per-benchmark ratio, geomean within group.
   Time-per-op units inverted so direction is consistent. The *calibrated*
   column divides out this runner's speed vs the baseline hardware, as
   measured by Groovy-independent pure-Java ruler benchmarks.
   
   | Group  | Speedup | Calibrated | n |
   |--------|---------|------------|---|
   | bench | 1.004 × | 1.012 × | 124 |
   | core | 2.677 × | 2.149 × | 108 |
   | grails | 0.997 × | 1.109 × | 80 |
   
   > ⚠️ **2 benchmarks at least 1.5× slower than the 90-day baseline:**
   > - `org.apache.groovy.bench.AryBench.groovyCS ( {"n":"1000000"} )` — 2.05× 
slower (calibrated)
   > - `org.apache.groovy.bench.StaticMethodCallIndyBench.staticChain_groovyCS` 
— 1.57× slower (calibrated)
   
   > ⚠️ Runner speed differs ≥15% from the historical baseline hardware for: 
core-ag, core-hz. Raw speedups are not meaningful for those parts — use the 
calibrated column.
   
   <sub>Runner calibration (this run vs baseline hardware): bench 0.99× (27 
rulers) · core-ag 1.24× (3 rulers) · core-hz 1.26× (3 rulers) · grails-ad 0.90× 
(3 rulers) · grails-ez 0.90× (3 rulers)</sub>
   
   <sub>Baseline: <code>dev/bench/jmh/&lt;part&gt;/indy/data.js</code> on 
gh-pages, trailing 90 days. <a 
href="https://apache.github.io/groovy/dev/bench/jmh/summary.html";>Daily 
dashboard</a> · <a 
href="https://apache.github.io/groovy/dev/bench/jmh/";>Per-suite raw 
data</a></sub>
   
   <!

> Generated code for overloaded assignment operator prevents garbage collection
> -----------------------------------------------------------------------------
>
>                 Key: GROOVY-10657
>                 URL: https://issues.apache.org/jira/browse/GROOVY-10657
>             Project: Groovy
>          Issue Type: Bug
>          Components: Compiler
>    Affects Versions: 4.0.3
>            Reporter: Jonathan Baxter
>            Assignee: Daniel Sun
>            Priority: Major
>             Fix For: 7.0.0-alpha-1, 6.0.1
>
>
> The groovy code 
> {code:java}
> obj["lhs"] = "rhs"{code}
> ostensibly converts to 
> {code:java}
> obj.putAt("lhs","rhs")
> {code}
> if {{obj}} has the appropriate {{putAt}} method.
> However , in the process of tracking down a memory leak, I discovered that 
> assignment is not exactly equivalent to invocation of the {{putAt}} method. 
> Specifically, the code generated by the compiler is equivalent to creating an 
> additional temporary variable to hold the rhs of the assignment, and then 
> invoking the {{putAt}} method with that temporary variable as its second 
> argument:
> {code:java}
> String string = "rhs"
> obj.putAt("lhs",string){code}
> The problem with this is that since {{"rhs"}} now has a live reference 
> ({{{}string{}}}), it is not eligible for garbage collection. 
> In my particular use case, {{"rhs"}} is a very large object that I would like 
> to be automatically garbage collected after the assignment is executed, but 
> before the script has finished. But that means I have to use the underlying 
> {{putAt}} method rather than the assignment operator, which rather negates 
> the benefits of overloading the assignment operator.
> One potential fix would be to simply null out any temporary variables 
> constructed by the compiler, so that 
> {code:java}
> obj["lhs"] = "rhs"
> {code}
>  becomes
> {code:java}
> String string = "rhs" 
> obj.putAt("lhs",string) 
> string = null <----- "rhs" is now eligible for garbage-collection{code}



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

Reply via email to