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(). Note that `Arrays.fill(…)` is simply a `for(…)` loop with an additional range check and is potentially subject to profile pollution due to [JDK‑8015417]: <https://github.com/openjdk/jdk/blob/c59debb3844d009ac501a48c31822a07f00521e9/src/java.base/share/classes/java/util/Arrays.java#L3449-L3453> [JDK‑8015417]: https://bugs.openjdk.org/browse/JDK-8015417 ------------- PR Comment: https://git.openjdk.org/jdk/pull/25237#issuecomment-2884908080