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

Compile time increases exponentially when compiling Class implementing a Trait

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.4.4, 2.4.7
    • 2.4.9
    • Compiler
    • None

    Description

      Concidering the following classes

      ATrait.groovy
      trait ATrait {
      }
      

      and

      AClass.groovy
      class AClass implements ATrait {
          def String cleanName(String name) {
              return name.
                  replaceAll(/alpha01/, '/').
                  replaceAll(/alpha02/, '/').
                  replaceAll(/alpha03/, '/').
                  replaceAll(/alpha04/, '/').
                  replaceAll(/alpha05/, '/').
                  replaceAll(/alpha06/, '/').
                  replaceAll(/alpha07/, '/').
                  replaceAll(/alpha08/, '/').
                  replaceAll(/alpha09/, '/').
                  replaceAll(/alpha10/, '/').
                  replaceAll(/alpha11/, '/').
                  replaceAll(/alpha12/, '/').
                  replaceAll(/alpha13/, '/').
                  replaceAll(/alpha14/, '/').
                  replaceAll(/alpha15/, '/').
                  replaceAll(/alpha16/, '/').
                  replaceAll(/alpha17/, '/').
                  replaceAll(/alpha18/, '/').
                  replaceAll(/alpha19/, '/').
                  replaceAll(/alpha20/, '/').
                  replaceAll(/alpha21/, '/').
                  replaceAll(/alpha22/, '/').
                  replaceAll(/alpha23/, '/').
      //            replaceAll(/alpha24/, '/').
      //            replaceAll(/alpha25/, '/').
                  replaceAll(/\//, ".").
                  replaceAll(/\.\.*/, ".").
                  replaceAll(/__+/, "_")
          }
      }
      

      compiles in about 6 seconds. If I remove the import of the Trait 'ATrait' in 'AClass' the compile proces only takes about 1 second.

      If you consider the classes as the are shown above then the compile time nearly duplicates for every method call I add to the chained method call.

      With the replaceAll with alpha24 being compiled the compilation process takes approximately 11 seconds and with alpha 25 being compiled in conjunction with alpha24 the compilation takes approximately 20 seconds.

      Attachments

        Activity

          People

            blackdrag Jochen Theodorou
            mklaehn Martin Klähn
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: