You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Stephen Mallette (Jira)" <ji...@apache.org> on 2020/12/29 16:03:00 UTC

[jira] [Commented] (GROOVY-9785) Performance degradation of groovysh for long scripts

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

Stephen Mallette commented on GROOVY-9785:
------------------------------------------

I'm not sure if anyone has had a chance to take a look at this issue yet, but I've had to return to it as generating the documentation for the Apache TinkerPop project took over 20 times its normal execution time. In re-examining the JFRs I noticed that Groovy 3.x generates a ton of GC. In 2.x there were just 6 GC events compared to over 170 for 3.x. The excessive GC appears to be driven by a glut of memory allocation that does not occur on 2.x at all. For comparison, 2.x has Est. TLAB Allocations of 745mb whereas 3.x is at 36gb. In 3.x these allocations seem to be driven quite heavily by {{ParserATNSimulator}} and {{ATNConfigSet}} each of which seems created for each line of a multiline script.  Does anyone have any thoughts on this analysis?

> Performance degradation of groovysh for long scripts
> ----------------------------------------------------
>
>                 Key: GROOVY-9785
>                 URL: https://issues.apache.org/jira/browse/GROOVY-9785
>             Project: Groovy
>          Issue Type: Bug
>          Components: Groovysh
>    Affects Versions: 3.0.6
>            Reporter: Stephen Mallette
>            Priority: Major
>         Attachments: groovy-2.5.13.jfr, groovy-3.0.6.jfr
>
>
> This issue was initially raised on the groovy-users mailing list ([here|https://lists.apache.org/thread.html/rb3ccd13570642038e822bd3e430999e0f5f430543edfdae92e895c0f%40%3Cusers.groovy.apache.org%3E]). The general issue is that long scripts pasted to groovysh in 3.x are parsed/read much more slowly than prior 2.x versions. From the mailing list:
> {code}
> groovy:000> start = System.currentTimeMillis()
> ===> 1603105239050
> groovy:000> 1 + 10 +
> groovy:001> 1 + 10 +
> groovy:002> 1 + 10 +
> groovy:003> 1 + 10 +
> groovy:004> 1 + 10 +
> groovy:005> 1 + 10 +
> groovy:006> 1 + 10 +
> ...
> groovy:495> 1 + 10 +
> groovy:496> 1 + 10 +
> groovy:497> 1 + 10
> ===> 5478
> groovy:000> System.currentTimeMillis() - start
> ===> 1193
> and on 3.0.6 I got:
> groovy:000> start = System.currentTimeMillis()
> ===> 1603105244825
> groovy:000> 1 + 10 +
> groovy:001> 1 + 10 +
> groovy:002> 1 + 10 +
> groovy:003> 1 + 10 +
> groovy:004> 1 + 10 +
> groovy:005> 1 + 10 +
> groovy:006> 1 + 10 +
> ...
> groovy:495> 1 + 10 +
> groovy:496> 1 + 10 +
> groovy:497> 1 + 10
> ===> 5478
> groovy:000> System.currentTimeMillis() - start
> ===> 31876
> {code}
> Note that JFRs are attached - perhaps they will shed some light on what is happening to someone familiar with the code.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)