RFR: 8369039: JDK-8348611 caused regression in Javac-Hot-Generate [v3]

Chen Liang liach at openjdk.org
Wed Oct 8 12:36:03 UTC 2025


On Tue, 7 Oct 2025 18:22:43 GMT, Archie Cobbs <acobbs at openjdk.org> wrote:

>> The refactoring in [JDK-8348611](https://bugs.openjdk.org/browse/JDK-8348611) caused a regression in compiler performance. In the the refactoring there were a couple of simple optimizations that were missed. When put in place, these seem to (mostly) address the performance issue.
>
> Archie Cobbs has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Do more desugaring of Stream and Optional.

src/jdk.compiler/share/classes/com/sun/tools/javac/code/LintMapper.java line 180:

> 178: 
> 179:         final LintRange rootRange;                              // the root LintRange (covering the entire source file)
> 180:         final List<Span> unmappedDecls = new LinkedList<>();    // unmapped top-level declarations awaiting attribution

LinkedList has a ton of nodes, which translate to extra object headers, forward/backward pointers, and worse cache locality. To add N items, it requires O(N) allocations. In contrast, ArrayList requires O(log(N)) allocations (resizing) and is almost always better.

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/27651#discussion_r2412374882


More information about the compiler-dev mailing list