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

Jan Lahoda jan.lahoda at oracle.com
Mon May 21 11:24:04 UTC 2018


Hi,

A webrev updated to the current situation, and with a comment explaining 
the need for the HashMap is here (as suggested offline):
http://cr.openjdk.java.net/~jlahoda/8193717/webrev.01/

Any feedback is welcome.

Thanks,
     Jan

On 2.3.2018 17:52, Jan Lahoda wrote:
> Hi,
>
> 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?
>
> Thanks,
>       Jan


More information about the compiler-dev mailing list