On Tue, 4 Nov 2025 20:18:20 GMT, Claes Redestad <[email protected]> wrote:

>> No, ArrayList.addAll(LinkedList).  This is the slow path that ideally will 
>> perform the same as before this change - and the initial change achieves 
>> that.  Rewriting to reduce duplication increased runtime of both the 
>> optimized and control.
>> 
>> I'll benchmark your suggestion as well.
>
> That variant is incorrect since `size <= a.length`, potentially adding a 
> surprising tail of `null` elements to the list.

Thank you both!  @cl4es splitting it out had zero performance impact (per the 
benchmark).  As you said, it's a bit subjective... how strongly do you feel?  
Other opinions are welcome too.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/28116#discussion_r2491983023

Reply via email to