You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Daniel Sun (JIRA)" <ji...@apache.org> on 2019/02/09 15:46:00 UTC

[jira] [Closed] (GROOVY-8977) Collect default imported class info for better resolving performance

     [ https://issues.apache.org/jira/browse/GROOVY-8977?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Daniel Sun closed GROOVY-8977.
------------------------------
       Resolution: Won't Fix
    Fix Version/s:     (was: 3.0.0-alpha-5)

As current implementation is dependent on classgraph(https://github.com/classgraph/classgraph) and it is not recommended for groovy core though the 3rd-party dependency is *optional* and will *not* be included in groovy distributions, I have to stop the work on the feature. To be frank, I have not much spare time to write a system lib scanner from scratch for groovy core, it is not trivial if its function is complete for Java7, Java8 and Java9+( https://github.com/classgraph/classgraph/blob/master/src/main/java/io/github/classgraph/Scanner.java ), so I close the JIRA ticket and the related PR.

> Collect default imported class info for better resolving performance
> --------------------------------------------------------------------
>
>                 Key: GROOVY-8977
>                 URL: https://issues.apache.org/jira/browse/GROOVY-8977
>             Project: Groovy
>          Issue Type: Improvement
>            Reporter: Daniel Sun
>            Assignee: Daniel Sun
>            Priority: Major
>          Time Spent: 1h 50m
>  Remaining Estimate: 0h
>
> Collect default imported class info to improve the hit ratio of cache with classgraph, which will not be included in the groovy distributions. As a result, the performance of resolving default imported class will be improved. On my local machine, the performance of resolving default imported class is improved {{36.93883149%}} by average:
> ||#||default(ms)||collectDefaultImports(ms)||percentage of time saved(%)||
> |1|2895|1629|43.73056994818653%|
> |2|2702|1777|34.233900814211694%|
> |3|2719|1931|28.981243104082385%|
> |4|2621|1560|40.48073254483022%|
> The collected default imported class info will be saved in directory {{$HOME/.groovy/caches}}, the cache file name is {{default_imported_classes}}. The cache file contains  groovy version, java version, default imported package names and default imported class info. When ①the groovy version or ②java version or ③default imported package names changes, the cache file will be updated.
> ①Option {{collectDefaultImports}} for compiler configuration and ②option {{groovy.collect.default.imports}} for JVM are *disabled by default* because the 3rd-party lib classgraph is not included in groovy core. So we have to complete the following 2 steps to enable the optimization feature:
>  1. place classgraph lib in the classpath(e.g.
>  * in gradle projects, add the following dependency
> {code:java}
> runtime 'io.github.classgraph:classgraph:4.6.32'{code}
>  * in common cases, put {{classgraph-4.6.32.jar}} into directory {{$GROOVY_HOME/lib}})
> 2. switch on *either* of the above options.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)