You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Jochen Theodorou (JIRA)" <ji...@apache.org> on 2017/01/26 20:07:24 UTC

[jira] [Commented] (GROOVY-8023) Compile time increases exponentially when compiling Class implementing a Trait

    [ https://issues.apache.org/jira/browse/GROOVY-8023?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15840350#comment-15840350 ] 

Jochen Theodorou commented on GROOVY-8023:
------------------------------------------

it was quadratic time complexity, now it is linear again: https://github.com/apache/groovy/commit/d3dd694969e85050b2b127280ad5ca7dcdfd2180

> 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.4, 2.4.7
>            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)