Martin Klähn created GROOVY-8023:
------------------------------------

             Summary: Compile time increases exponentially when compiling Class 
implementing a Trait
                 Key: GROOVY-8023
                 URL: https://issues.apache.org/jira/browse/GROOVY-8023
             Project: Groovy
          Issue Type: Bug
          Components: Compiler
    Affects Versions: 2.4.7, 2.4.4
            Reporter: Martin Klähn


Concidering the following classes
{code:title=ATrait.groovy|borderStyle=solid}
trait ATrait {
}
{code}
and
{code:title=AClass.groovy|borderStyle=solid}
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(/__+/, "_")
    }
}
{code}
 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.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to