RFR: JDK-8193717: Import resolution performance regression in JDK 9

Jan Lahoda jan.lahoda at oracle.com
Fri Mar 2 16:52:21 UTC 2018


Having a source with a lot of imports can lead to a long compilation 
time, as the imports are lazily searched on each query to the Scope. But 
at least for named imports, the name is known, and can be used for quick 
filtering. (Sadly, for on-demand imports/package imports, this is much 
more difficult, and this patch does not improve them.)

The principle of the patch is to have a map from name to scopes that may 
contain the given name in Scope.NamedImportScope.

Also, the "current-file top-level scope" 
(JCCompilationUnit.toplevelScope) is no longer appended to the named 
import scope, but rather the relevant lookup is enhanced to query it as 
well if needed. This seems cleaner that trying to append the scope to 
the fast name lookup.

Bug: https://bugs.openjdk.java.net/browse/JDK-8193717
Webrev: http://cr.openjdk.java.net/~jlahoda/8193717/webrev.00/

Liam, could you please check if this helps with your real-world case?

How does this look?


More information about the compiler-dev mailing list