[foreign-memaccess] RFR: Move MemoryAddress::copy
Maurizio Cimadamore
mcimadamore at openjdk.java.net
Fri May 15 13:51:46 UTC 2020
As discussed, this patch moves `MemoryAddress::copy` as an *instance* method of `MemorySegment`, namely
`MemorySegment::copyFrom`. I chose the `copyFrom` suggestion from John, since it allows us more freedom, in the future,
to add overloads for different sources for the copy operation.
I've rewrorked the documentation a bit to speak about segment offsets rather than addresses.
I believe all use cases touched by this change actually lead to simpler code, which is good.
I've also added a benchmark for some of the bulk operations such as fill and copyFrom - the numbers I've got look good:
Benchmark Mode Cnt Score Error Units
BulkOps.segment_copy avgt 30 441675.750 ? 12794.881 ns/op
BulkOps.segment_fill avgt 30 122465.908 ? 1760.711 ns/op
BulkOps.unsafe_copy avgt 30 430153.694 ? 9055.253 ns/op
BulkOps.unsafe_fill avgt 30 120413.079 ? 3799.484 ns/op
Cheers
-------------
Commit messages:
- Added benchmark for bulk operations
- Move static MemoryAddress::copy into instance method inside MemorySegment
Changes: https://git.openjdk.java.net/panama-foreign/pull/169/files
Webrev: https://webrevs.openjdk.java.net/panama-foreign/169/webrev.00
Stats: 172 lines in 8 files changed: 130 ins; 38 del; 4 mod
Patch: https://git.openjdk.java.net/panama-foreign/pull/169.diff
Fetch: git fetch https://git.openjdk.java.net/panama-foreign pull/169/head:pull/169
PR: https://git.openjdk.java.net/panama-foreign/pull/169
More information about the panama-dev
mailing list