Hi Per, Thanks very much. Looks like there's lots of good info out there but I didn't really know where to start so I appreciate the references.
-Archie On Fri, May 23, 2025 at 3:31 AM Per-Ake Minborg <per-ake.minb...@oracle.com> wrote: > Hi Archie! > > The C2 compiler can use *automatic vectorization* [1] to speed up such > operations. You can watch my explanation of the concept in some of my > recent presentations, e.g, [2] > > Best, Per > YouTube <https://youtu.be/rXv2-lN5Xgk?t=1518> > Share your videos with friends, family, and the world > youtu.be > > Automatic vectorization - Wikipedia > <https://en.wikipedia.org/wiki/Automatic_vectorization> > Automatic vectorization, in parallel computing, is a special case of > automatic parallelization, where a computer program is converted from a > scalar implementation, which processes a single pair of operands at a time, > to a vector implementation, which processes one operation on multiple pairs > of operands at once. For example, modern conventional computers, including > specialized supercomputers ... > en.wikipedia.org > [1] https://en.wikipedia.org/wiki/Automatic_vectorization > [2] https://youtu.be/rXv2-lN5Xgk?t=1518 > ------------------------------ > *From:* core-libs-dev <core-libs-dev-r...@openjdk.org> on behalf of > Archie Cobbs <archie.co...@gmail.com> > *Sent:* Thursday, May 22, 2025 10:58 PM > *To:* John R Rose <jr...@openjdk.org> > *Cc:* core-libs-dev@openjdk.org <core-libs-dev@openjdk.org> > *Subject:* Re: RFR: 8357531: The `SegmentBulkOperations::fill` method can > be improved using overlaps [v5] > > 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 > -- Archie L. Cobbs