ODP: Foreign + Vectors - benchmarks for copying and swapping

Maurizio Cimadamore maurizio.cimadamore at oracle.com
Fri Jun 18 08:09:10 UTC 2021


On 17/06/2021 23:14, Radosław Smogura wrote:
> For endianess, I'm not sure how to check it, but it may not be a case, 
> I try to use native order, and operate on bytes.

I guess what I mean is:

https://github.com/rsmogura/panama-foreign/blob/foreign_and_vectors/test/micro/org/openjdk/bench/jdk/incubator/foreign/VectorCopySegments.java#L91

Should this be:

```
final var src = srcAddress.asSegment(size, 
scope).asByteBuffer().order(ByteOrder.nativeOrder());

```

And same for other derived buffers? You then use it as this:

```
final var srcVector = ByteVector.fromByteBuffer(BYTE_VECTOR_SPECIES, 
src, i, ByteOrder.nativeOrder());

```

Which does smell like mismatched access?

Cheers
Maurizio





More information about the panama-dev mailing list