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

Gavin Ray duke at openjdk.org
Thu Jan 5 21:41:22 UTC 2023


On Wed, 4 Jan 2023 08:00:15 GMT, Per Minborg <pminborg at openjdk.org> wrote:

>> This PR proposes the addition of some benchmarks, for example using a LonBuffer and a VarHandle.
>
> Per Minborg has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Change to big endian for some variants

According to this data, if your application primarily works with reading/writing/copying of buffers & binary data

Then you're better off (perf-wise) using Panama FFM `MemorySegment` with `MemorySegment#copy` rather than ByteBuffers or byte-arrays?

I'd be curious if you lose any of this benefit if you have to adapt the MemorySegment with `.asByteBuffer()` for calling existing API's that require BB's too, like for example `java.nio.AsynchronousSocketServer` callbacks and the like.

(The size here is in `long-bytes`, right? So it's x8 with `256` being a 2kb buffer?)

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

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


More information about the panama-dev mailing list