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

Archie Cobbs acobbs at openjdk.org
Thu May 15 20:07:53 UTC 2025


On Thu, 15 May 2025 19:53:03 GMT, ExE Boss <duke at openjdk.org> wrote:

> Note that `Arrays.fill(…)` is simply a `for(…)` loop with an additional range check

Interesting... I was assuming that most of the "bulk" methods in `Arrays` were being hand-optimized with special hardware magic (e.g., vector instructions), and that the opportunity to do this was part of the motivation for adding them in the first place.

If C2 is already able to automatically optimize this into the maximum possible hardware performance, then great! But is that actually the case?

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

PR Comment: https://git.openjdk.org/jdk/pull/25237#issuecomment-2884933648


More information about the core-libs-dev mailing list