On Thu, 15 May 2025 17:46:39 GMT, Archie Cobbs <aco...@openjdk.org> wrote:

>> Please review this small performance tweak `ArrayDeque`.
>> 
>> `ArrayDeque` has an invariant in which any unused elements in the array must 
>> be null. In a couple of places, the code is setting contiguous ranges of 
>> elements to null using `for()` loops. This can be both simplified and sped 
>> up by using `Arrays.fill()` instead.
>
> Archie Cobbs has updated the pull request incrementally with one additional 
> commit since the last revision:
> 
>   Add benchmark for ArrayDeque.clear().

test/jdk/java/util/ArrayDeque/ClearBenchmarkTestJMH.java line 64:

> 62:     @Measurement(iterations = 10)
> 63:     @Warmup(iterations = 3)
> 64:     public void fillAndClear() {

I think you need to return the collection or send it to a BlackHole

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

PR Review Comment: https://git.openjdk.org/jdk/pull/25237#discussion_r2091698886

Reply via email to