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

Jan Lahoda jan.lahoda at oracle.com
Fri Jul 13 08:15:04 UTC 2018


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