[
https://issues.apache.org/jira/browse/GROOVY-9785?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17690452#comment-17690452
]
Eric Milles edited comment on GROOVY-9785 at 2/17/23 4:22 PM:
--------------------------------------------------------------
Running under Groovy 2.5.21 and 3.0.15 (Java 1.8.0_351), I get a similar
result: ~2000ms
Running under Groovy 3.0.15 and Groovy 4.0.9 (replace
"org.codehaus.groovy.tools.shell" with "org.apache.groovy.groovysh"), I get
>20000ms
Can you retest with Groovy 2.5 and 3.0? I will have a look at what 4.0 is
doing that is different from 3.0 where I would expect similar behavior.
Update: This is why old {{Groovysh}} under Groovy 3.0 performs like Groovy 2.5:
{code:java}
parser.getConfiguration().setPluginFactory(ParserPluginFactory.antlr2()) // We
have to stick to the old parser before GROOVY-8279 is fixed
{code}
https://github.com/apache/groovy/blob/GROOVY_3_0_X/subprojects/groovy-groovysh/src/main/groovy/org/codehaus/groovy/tools/shell/Parser.groovy#L159
was (Author: emilles):
Running under Groovy 2.5.21 and 3.0.15 (Java 1.8.0_351), I get a similar
result: ~2000ms
Running under Groovy 3.0.15 and Groovy 4.0.9 (replace
"org.codehaus.groovy.tools.shell" with "org.apache.groovy.groovysh"), I get
>20000ms
Can you retest with Groovy 2.5 and 3.0? I will have a look at what 4.0 is
doing that is different from 3.0 where I would expect similar behavior.
> 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,
> 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)