danielsun1106 edited a comment on issue #1135: GROOVY-8298: Slow Performance 
Caused by Invoke Dynamic
URL: https://github.com/apache/groovy/pull/1135#issuecomment-570983832
 
 
   Here is an edge case: we set `groovy.indy.optimize.threshold` to `0` at 
first, so the target of callsite `toString` will be set because the 
threshold(`0`) reaches. The newly set target is not good for polymorfic 
calls(the subsequent calls when `i >= 10`), so when fallback count reaches 
threshold, we will reset to the `fromCache` target, i.e. the default target.
   ```groovy
   for (int i = 0; i < 1_000_000; i++) {
       [1, 2.0f, '3.0'].each {
           if (1 != it && i < 10) return
           
           it.toString() 
       }
   }
   ```
   (indy2(after d799d22, `groovy.indy.optimize.threshold`: `0`): **3s**; 
indy2(before d799d22, `groovy.indy.optimize.threshold`: `0`): **12s**; indy1: 
**27s**; CS: **4s**; on my another machine)
   

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to