RFR: 8371164: ArrayList.addAll() optimizations [v2]
Claes Redestad
redestad at openjdk.org
Tue Nov 4 18:45:54 UTC 2025
On Tue, 4 Nov 2025 18:32:26 GMT, jengebr <duke at openjdk.org> wrote:
>> Ok, if the split helps the JIT peel and optimize better some amount of code duplication can be fine, but maybe then split out the two implementations to separate methods (to help inlining) and comment that the code duplication is intentional and should be handled with care.
>
> The comment is a good idea, but splitting out the duplication may make maintenance even worse by separating the duplicate sections. What do you think?
>
> Also, I'll benchmark with the split to get the impact data. Not sure I can meaningfully validate an impact to inlining.
I think peeling off and outlining distinct paths in a larger method to separate, simpler methods usually reduces distracting noise and improves readability, but I guess that's subjective territory.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/28116#discussion_r2491695436
More information about the core-libs-dev
mailing list