danielsun1106 commented on issue #1135: GROOVY-8298: Slow Performance Caused by 
Invoke Dynamic
URL: https://github.com/apache/groovy/pull/1135#issuecomment-574100086
 
 
   I picked the fastest result of the different version of Groovy
   indy2: 4693ms; indy1: 5268ms; cs: 6007ms
   
   **indy2 vs indy1:** 10.91% time reduced
   **indy2 vs cs:** 21.87% time reduced
   
   ```groovy
           final Random random = new Random()
           final int limit = 1_000_000
           
           def factorial
           factorial = { n, acc = 1G -> 1 >= n ? acc : factorial(n - 1, acc * n 
) }
   
           for (int i = 0; i < limit; i++) {
               factorial(30 + random.nextInt(5))
           }
   ```
   (Copied from 
https://e.printstacktrace.blog/groovy-trampoline-closure-a-step-into-recursive-closures/)
   

----------------------------------------------------------------
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