<div dir="ltr">That's right! Sorry, thank you for spotting this, I have updated the benchmarks.<div><br></div><div>-Antoine</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, Mar 22, 2024 at 11:10 AM Roland Westrelin <<a href="mailto:rwestrel@redhat.com">rwestrel@redhat.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><br>
>  .vectorArrayArray             7252565.080 ops/s<br>
>  .vectorArraySegment           6938948.826 ops/s<br>
>  .vectorSegmentArray           4953042.042 ops/s<br>
>  .vectorSegmentSegment         4606278.152 ops/s<br>
<br>
I think some of the vector API tests are buggy. Shouldn't<br>
vectorArraySegment be something like:<br>
<br>
    public void vectorArraySegment(Data state) {<br>
        final double[] input = state.inputArray;<br>
        final MemorySegment output = state.outputSegment;<br>
<br>
        for (int i = 0; i < input.length; i+=SPECIES.length()) {<br>
            DoubleVector a = DoubleVector.fromArray(SPECIES, input, i);<br>
            long offset = ((long)i) * (SPECIES.vectorByteSize() / SPECIES.length());<br>
            DoubleVector b = DoubleVector.fromMemorySegment(SPECIES, output, offset, ByteOrder.nativeOrder());<br>
            a = a.add(b);<br>
            a.intoMemorySegment(output, offset, ByteOrder.nativeOrder());<br>
        }<br>
    }<br>
<br>
because intoMemorySegment() and fromMemorySegment() take an offset and<br>
not an index as input?<br>
<br>
With that fixed (assuming I got this right), all vector API tests<br>
perform about the same.<br>
<br>
Roland.<br>
<br>
</blockquote></div>