RFR: 8356993: ArrayDeque should use Arrays.fill() instead of for() loops [v2]
Raffaello Giulietti
rgiulietti at openjdk.org
Thu May 15 18:35:51 UTC 2025
On Thu, 15 May 2025 17:56:10 GMT, Archie Cobbs <acobbs at openjdk.org> wrote:
>> 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
>
>> I think you need to return the collection or send it to a BlackHole
>
> I'm fairly new to the benchmark game so I would not be surprised if this is broken.
>
> Previously I was adding them to a list but that caused OOMs.
>
> Can you clarify what you mean? By 'return' do you just mean returning the deque from the method? Also I don't konw what a BlackHole is.
>
> Apologies for not knowing what I'm doing here. Thanks.
Here are many [exmaples](https://github.com/openjdk/jmh/tree/master/jmh-samples/src/main/java/org/openjdk/jmh/samples) on how to correctly use JMH.
A [blackhole](https://github.com/openjdk/jmh/blob/master/jmh-samples/src/main/java/org/openjdk/jmh/samples/JMHSample_09_Blackholes.java) prevents the compiler to optimize away your code.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/25237#discussion_r2091761040
More information about the core-libs-dev
mailing list