Slow compilation with a lot of type inference

Nir Lisker nlisker at gmail.com
Mon Jul 19 17:13:51 UTC 2021


Hi,

I have recently submitted an Eclipse bug [1] regarding very slow
compilation when a lot of type inference is required. The report includes
an example case, which looks like:

public static final Map<String, String> DESC = Map.ofEntries(
    Map.entry("A", "B"),
    Map.entry("A", "B"),
    Map.entry("A", "B"),
    // many more of these
);

The Eclipse developer shows that the slowness happens in javac as well. I
understand that every entry needs to be looked at to find the type for
Map.ofEntries, and the problem can be resolved by adding Map.<String,
String>ofEntries, but I thought it's worth asking here too.

Is this considered normal behavior?

[1] https://bugs.eclipse.org/bugs/show_bug.cgi?id=574732

- Nir
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.java.net/pipermail/compiler-dev/attachments/20210719/3d703524/attachment.htm>


More information about the compiler-dev mailing list