[
https://issues.apache.org/jira/browse/GROOVY-10307?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17533853#comment-17533853
]
Daniel Sun commented on GROOVY-10307:
-------------------------------------
Adjusted the loop times to a greater number as follows to make performance
problem a bit more clear:
{code:java}
final int nrLoops = 10
final int nrLoopsInner = 1000
{code}
([^groovysql_performance_groovy4_2_xx_yy_zzzz.groovy] )
h3. The async profiler results are attached:
*3.0.10*
[^profile3.txt]
*4.0.2* with {{-Dgroovy.indy.optimize.threshold=0}} set
[^profile4.txt]
*4.0.2* with default system properties
[^profile4d.txt]
As we can find in the above profling result, here are some time consuming
method invocations when running with Groovy 4.0.2, it seems that the program is
not running under the fast path:
{code:java}
2335338100 2.39% 233 java.lang.invoke.MethodHandle.invokeBasic
1169649000 1.20% 117 java.lang.Class.getMethodsRecursive
889888500 0.91% 89
org.codehaus.groovy.vmplugin.v8.IndyGuardsFiltersAndSignatures.sameClass
569952200 0.58% 57 java.lang.PublicMethods$MethodList.filter
539656300 0.55% 54 java.util.concurrent.ConcurrentHashMap.tabAt
533934800 0.55% 54 java.lang.invoke.MethodHandleImpl.profileBoolean
500013900 0.51% 50 java.util.concurrent.ConcurrentHashMap.get
499650000 0.51% 50
java.lang.invoke.DirectMethodHandle$Holder.invokeStatic
480014600 0.49% 48 java.lang.PublicMethods$MethodList.<init>
459904200 0.47% 46 java.lang.invoke.MethodType.equals
419653900 0.43% 42 java.lang.invoke.LambdaForm$MH/1252820474.guard
409954100 0.42% 41 java.lang.String.equals
370014100 0.38% 37
java.lang.invoke.MethodType$ConcurrentWeakInternSet$WeakEntry.<init>
359689900 0.37% 36 java.lang.Class.getInterfaces
349918700 0.36% 35 java.util.Arrays.equals
{code}
P.S. the following PR to solve de-opt storm issue can be found at
[https://github.com/apache/groovy/pull/1135]
[^loops.groovy] running under the fast path:
*4.0.2* with {{-Dgroovy.indy.optimize.threshold=0}} set
[^profile4-loops.txt]
> Groovy 4 runtime performance on average 2.4x slower than Groovy 3
> -----------------------------------------------------------------
>
> Key: GROOVY-10307
> URL: https://issues.apache.org/jira/browse/GROOVY-10307
> Project: Groovy
> Issue Type: Bug
> Components: bytecode
> Affects Versions: 4.0.0-beta-1, 3.0.9
> Environment: OpenJDK Runtime Environment AdoptOpenJDK-11.0.11+9
> (build 11.0.11+9)
> OpenJDK 64-Bit Server VM AdoptOpenJDK-11.0.11+9 (build 11.0.11+9, mixed mode)
> WIN10 (tests) / REL 8 (web application)
> IntelliJ 2021.2
> Reporter: mgroovy
> Priority: Major
> Attachments: groovy_3_0_9_gc.png, groovy_3_0_9_loop2.png,
> groovy_3_0_9_loop4.png, groovy_3_0_9_mem.png, groovy_4_0_0_b1_loop2.png,
> groovy_4_0_0_b1_loop4.png, groovy_4_0_0_b1_loop4_gc.png,
> groovy_4_0_0_b1_loop4_mem.png,
> groovysql_performance_groovy4_2_xx_yy_zzzz.groovy, loops.groovy,
> profile3.txt, profile4-loops.txt, profile4.txt, profile4d.txt
>
>
> Groovy 4.0.0-beta-1 runtime performance in our framework is on average 2 to 3
> times slower compared to using Groovy 3.0.9 (regular i.e. non-INDY)
> * Our complete framework and application code is completely written in
> Groovy, spread over multiple IntelliJ modules
> ** mixed @CompileDynamic/@TypeChecked and @CompileStatic
> ** No Java classes left in project, i.e. no cross compilation occurs
> * We build using IntelliJ 2021.2 Groovy build process, then run / deploy the
> compiled class files
> ** We do _not_ use a Groovy based DSL, nor do we execute Groovy scripts
> during execution
> * Performance degradation when using Groovy 4.0.0-beta-1 instead of Groovy
> 3.0.9 (non-INDY):
> ** The performance of the largest of our web applications has dropped 3x
> (startup) / 2x (table refresh) respectively
> *** Stack: Tomcat/Vaadin/Ebean plus framework generated SQL
> ** Our test suite runs about 2.4 times as long as before (120 min when using
> G4, compared to about 50 min with G3)
> *** JUnit 5
> *** test suite also contains no scripts / dynamic code execution
> *** Individual test performance varies: A small number of tests runs faster,
> but the majority is slower, with some extreme cases taking nearly 10x as long
> to finish
> * Using Groovy 3.0.9 INDY displays nearly identical performance degradation,
> so it seems that the use of invoke dynamic is somehow at fault
--
This message was sent by Atlassian Jira
(v8.20.7#820007)