You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Eric Milles (Jira)" <ji...@apache.org> on 2023/02/17 17:13:00 UTC

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

     [ https://issues.apache.org/jira/browse/GROOVY-9785?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Eric Milles updated GROOVY-9785:
--------------------------------
    Component/s: parser-antlr4

> 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, parser-antlr4
>    Affects Versions: 3.0.6
>            Reporter: Stephen Mallette
>            Priority: Major
>         Attachments: groovy-2.5.13.jfr, groovy-3.0.6.jfr, test-groovysh-incomplete-multiline.groovy
>
>
> 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.20.10#820010)