RFR: 8356993: ArrayDeque should use Arrays.fill() instead of for() loops [v3]

Archie Cobbs acobbs at openjdk.org
Thu May 15 21:04:40 UTC 2025


> 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:

  Blackhole ArrayDeque to ensure it's not ignored by the compiler.

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

Changes:
  - all: https://git.openjdk.org/jdk/pull/25237/files
  - new: https://git.openjdk.org/jdk/pull/25237/files/1b8fb830..9f0c5fe1

Webrevs:
 - full: https://webrevs.openjdk.org/?repo=jdk&pr=25237&range=02
 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=25237&range=01-02

  Stats: 4 lines in 1 file changed: 2 ins; 1 del; 1 mod
  Patch: https://git.openjdk.org/jdk/pull/25237.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/25237/head:pull/25237

PR: https://git.openjdk.org/jdk/pull/25237


More information about the core-libs-dev mailing list