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

Maurizio Cimadamore mcimadamore at openjdk.org
Tue Jan 3 10:33:07 UTC 2023


On Tue, 3 Jan 2023 10:27:10 GMT, Maurizio Cimadamore <mcimadamore at openjdk.org> wrote:

>> 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?
>
> Nevermind - that seems to be correct - it's equivalent to `ByteBuffer.getLong`

Might be worth trying this benchmark with the VM flag: `-Djava.lang.invoke.VarHandle.VAR_HANDLE_GUARDS=false`, to see if VH guards are contributing to a major speedup here.

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

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


More information about the panama-dev mailing list