Uploaded image for project: 'Groovy'
  1. Groovy
  2. GROOVY-9785

Performance degradation of groovysh for long scripts

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Information Provided
    • 3.0.6
    • None
    • Groovysh, parser-antlr4
    • None

    Description

      This issue was initially raised on the groovy-users mailing list (here). 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:

      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
      

      Note that JFRs are attached - perhaps they will shed some light on what is happening to someone familiar with the code.

      Attachments

        1. groovy-2.5.13.jfr
          1.38 MB
          Stephen Mallette
        2. groovy-3.0.6.jfr
          9.91 MB
          Stephen Mallette
        3. test-groovysh-incomplete-multiline.groovy
          12 kB
          Stephen Mallette

        Issue Links

          Activity

            People

              emilles Eric Milles
              spmallette Stephen Mallette
              Votes:
              2 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: