[foreign-memaccess+abi] RFR: 8268743: Require a better way for copying data between MemorySegments and on-heap arrays
Maurizio Cimadamore
mcimadamore at openjdk.java.net
Wed Jun 16 10:09:46 UTC 2021
On Wed, 16 Jun 2021 09:44:55 GMT, Uwe Schindler <uschindler at openjdk.org> wrote:
> So would the new MemoryCopy class from the other pull request help, because it has `@ForceInline`?
Possibly, although our philosophy behind adding static helpers is that they should be just "helpers", not a way to get more performant code. That is, you get same performance with a VarHandle call than you get with MemoryAccess::get. But if the basic `copyFrom` does not always offer the expected performance model, then I'd claim it's a bug in that the API exposes the "wrong" primitive (because use cases for scalar memory access are very different from bulk memory access, for the reasons mentioned above). But let's first verify that this is indeed what's causing the degradation for Lucene. You mentioned that the copy method were called "millions of times" which makes it unlikely for them to be completely "cold" and unoptimized.
-------------
PR: https://git.openjdk.java.net/panama-foreign/pull/560
More information about the panama-dev
mailing list