[foreign-memaccess+abi] RFR: 8270376: Finalize API for memory copy [v9]

Maurizio Cimadamore mcimadamore at openjdk.java.net
Fri Aug 6 18:06:42 UTC 2021


On Fri, 6 Aug 2021 17:48:41 GMT, Maurizio Cimadamore <mcimadamore at openjdk.org> wrote:

> > Now you got me looking at `MemorySegment.fill`! Arguably that is a bulk copy broadcasting a scalar, like `Arrays.fill`.
> 
> Yes, it's a memset.

out of curiosity, I did some experiment:

BulkOps.segment_fill         avgt   30  60076.605 ? 702.267  ns/op
BulkOps.segment_fill_manual  avgt   30  44685.159 ? 537.964  ns/op

It seems like a manual loop with segments is faster than doing a memset (probably because of unrolling and vectorization). If that's the case, I think there's a strong case to move fill away from `MemorySegment` and into the `MemoryAccess` class.

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

PR: https://git.openjdk.java.net/panama-foreign/pull/568


More information about the panama-dev mailing list