[foreign-memaccess+abi] RFR: Add benchmarks to MemorySegmentVsBits

Maurizio Cimadamore mcimadamore at openjdk.org
Tue Jan 3 10:27:08 UTC 2023


On Mon, 2 Jan 2023 10:25:17 GMT, Per Minborg <pminborg at openjdk.org> wrote:

> This PR proposes the addition of some benchmarks, for example using a LonBuffer and a VarHandle.

Looks good. It seems like the memory segment implementation breaks even at size = 16?
On top of my head I can't explain why the plain var handle (`byteVarHandle`) is so much faster than anything else. 1but perhaps the benchmark is flawed there?

test/micro/org/openjdk/bench/java/lang/foreign/MemorySegmentVsBits.java line 109:

> 107:     public void byteVarHandle() {
> 108:         for (int i = 0; i < size; i++) {
> 109:             LONG_ARRAY_VH.set(bytes, i * Long.BYTES, longs[i]);

Is this offset multiplication correct? e.g. I would assume that var handles created with `byteArrayView` would take a logical index?

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

PR: https://git.openjdk.org/panama-foreign/pull/762


More information about the panama-dev mailing list