RFR: 8369039: JDK-8348611 caused regression in Javac-Hot-Generate [v3]
Chen Liang
liach at openjdk.org
Wed Oct 8 14:41:35 UTC 2025
On Wed, 8 Oct 2025 14:07:46 GMT, Chen Liang <liach at openjdk.org> wrote:
>> While I agree `ArrayList`s are often better, @archiecobbs measured the `LinkedList`s perform better here, as @cl4es says.
>>
>> I am not quite clear why linked lists are faster, but it might be many of the lists are either empty (all the `children` of the leaf `LintRange` instances will be empty lists, I think, and an empty `LinkedList` is, I think, cheaper than an empty `ArrayList`), and some of them will have only a few entries (like the `unmappedDecls` list here: 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). If `ArrayList`s with substantial number of entries are only a small minority, it might explain why the use of `LinkedList`s leads to better results.
>
> 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.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/27651#discussion_r2414093460
More information about the compiler-dev
mailing list