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

Archie Cobbs acobbs at openjdk.org
Wed Oct 8 14:52:51 UTC 2025


On Wed, 8 Oct 2025 14:38:58 GMT, Chen Liang <liach at openjdk.org> wrote:

>> I think the right way to fix is not to use LinkedList, but to update afterAttr to use List.removeIf - this was added back in 8 to avoid the overhead of shifting from multiple removals.
>
> On second look my last analysis was wrong. This is removing one element which is probably better done as an operation on a TreeSet, which is okay. However, I don't find why we would use a LinkedList for LintRange.

>  AFAIK, this has one entry for each top-level declaration, and hence is highly unlikely to have more than 2 entries - one for the package clause, and one for the top-level class

Actually it will most likely only have one entry - package declarations are not included because they can never contain `@SuppressWarnings` annotations. This may explain why `LinkedList` is faster on average.

> I don't find why we would use a LinkedList for LintRange.

The same answer may apply here, but honestly I'm just guessing at this. I was also surprised that `LinkedList` was faster than `ArrayList`, but the numbers seem to be saying that.

In fact, as you point out, `unmappedDecls` could be a `Set` instead of a `List`. But whether that would actually help is not clear.

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

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


More information about the compiler-dev mailing list