RFR(11): JDK-8189747: JDK9 javax.lang.model.util.Elements#getTypeElement regressed 1000x in performance.

joe darcy joe.darcy at oracle.com
Fri Jul 13 16:35:39 UTC 2018


Hi Jan,

Looks fine; thanks,

-Joe


On 7/13/2018 1:15 AM, Jan Lahoda wrote:
> Hi,
>
> Since the addition of modules, the 
> Elements.getTypeElement(CharSequence) and 
> Elements.getPackageElement(CharSequence) methods need to look into all 
> modules when looking for Type/Package Elements. This may make these 
> methods significantly slower than before.
>
> Sadly, I am sure if it is possible to make the methods as fast as 
> before, while still looking into all modules. A possible solution for 
> cases where the API clients look repeatedly for the same type/package 
> may be to introduce a cache for the results. That is the proposed 
> patch here. An alternative for the clients is to use the variants of 
> the methods that accept ModuleElement as the base for the search.
>
> Bug: https://bugs.openjdk.java.net/browse/JDK-8189747
> Webrev: http://cr.openjdk.java.net/~jlahoda/8189747/webrev.00/
>
> Thanks,
>     Jan



More information about the compiler-dev mailing list