[foreign-memaccess+abi] RFR: Add benchmarks to MemorySegmentVsBits
Per Minborg
pminborg at openjdk.org
Tue Jan 3 11:38:08 UTC 2023
On Mon, 2 Jan 2023 10:25:17 GMT, Per Minborg <pminborg at openjdk.org> wrote:
> This PR proposes the addition of some benchmarks, for example using a LonBuffer and a VarHandle.
> > Looks good. It seems like the memory segment implementation breaks even at size = 16? On top of my head I can't explain why the plain var handle (`byteVarHandle`) is so much faster than anything else. 1but perhaps the benchmark is flawed there?
>
> That's good! We use it everywhere in Lucene when getting long/int/short out of byte arrays :-) But I agree, the access for memory segments should be as fast as basically it is also just a VarHandle. Maybe the guards are indeed the problem.
>
> I think, to replace `java.nio.Bits` in the JDK I would use the plain simple VarHandle instead of wrapping they bytes with a MemorySegment or a ByteBuffer. I could provide a simple PR for the JDK that changes the NIO Bits methods by delgating to the mentioned VarHandle :-). But that's unrelated to Panama, I know :-)
I have a solution in the making of this but it would be great if you could review it @uschindler
-------------
PR: https://git.openjdk.org/panama-foreign/pull/762
More information about the panama-dev
mailing list