[foreign-jextract] RFR: MemorySegmentPool + Allocator [v8]

Radoslaw Smogura github.com+7535718+rsmogura at openjdk.java.net
Thu Apr 22 20:26:43 UTC 2021


On Thu, 22 Apr 2021 12:09:30 GMT, Radoslaw Smogura <github.com+7535718+rsmogura at openjdk.org> wrote:

>> That said, IMHO, in the new benchmark, the cost of reading dominates everything else. It's not an issue with the memory access API either - replacing read with Unsafe::putInt it still slow. Honestly, since you are after measuring allocation performances, I'm not sure if `readSegment` even belongs here. The more allocations you have, with bigger sized segments, the more read will dominate anything else, to the point of rendering the benchmark not very useful to measure what you want to measure. In fact, even the `strlen` call was an issue in the previous benchmark - as the size of string grows, the time spent in copying data, and strlen grows as well, which then masks the allocation costs. Here you have a similar situation, I think.
>
> That's a pity JMH does not allow sub measurements

I think that issue is related how JVM shapes code. If I'll write something like this 
readSegment(s.memoryAddress.asSegment(size, scope));
so I'll allocate a new segment based on address than the read performance goes up, and it's same as malloc version

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

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


More information about the panama-dev mailing list