On Thu, May 22, 2025 at 3:31 PM John R Rose <jr...@openjdk.org> wrote:

> >   Update benchmark to reflect new fill method
>
> Related discussion at the hardware level:
>
> https://github.com/openjdk/jdk/pull/25147#issuecomment-2902463076
>

This discussion spurred me to ask a dumb question. Apologies in advance,
just trying to learn here...

If I do this:

import java.util.Arrays;
public class ArrayFiller {
    public static void main(String[] args) {
        while (true) {
            final byte[] array = new byte[1000000];
            Arrays.fill(array, (byte)0x42);
        }
    }
}

Will C2 compile Arrays.fill()
<https://github.com/openjdk/jdk/blob/139a05d05959a84541a29dfae6151f92ce579ae6/src/java.base/share/classes/java/util/Arrays.java#L3275-L3308>
into something that is more efficient than a byte-at-a-time loop like what
appears in the source code?

Thanks,
-Archie

-- 
Archie L. Cobbs

Reply via email to