RFR: 8254693: Add Panama feature to pass heap segments to native code [v2]
Jorn Vernee
jvernee at openjdk.org
Wed Oct 18 10:51:22 UTC 2023
On Wed, 18 Oct 2023 09:48:47 GMT, Jorn Vernee <jvernee at openjdk.org> wrote:
>> test/micro/org/openjdk/bench/java/lang/foreign/CriticalCalls.java line 101:
>>
>>> 99: public int callNotPinned() throws Throwable {
>>> 100: try (Arena arena = Arena.ofConfined()) {
>>> 101: MemorySegment nativeArr = arena.allocate(JAVA_INT, arr.length);
>>
>> This allocation method will zero the segment. I think that's a bit unfair and will bias the results against non-pinned, right?
>
> Good point. I made this benchmark a while ago, before we had the more optimized allocate variants
This had a pretty big impact, actually. Especially on the larger sizes:
Benchmark (size) Mode Cnt Score Error Units
CriticalCalls.callNotPinned 100 avgt 30 84.818 � 0.729 ns/op
CriticalCalls.callNotPinned 10000 avgt 30 2966.918 � 39.898 ns/op
CriticalCalls.callNotPinned 1000000 avgt 30 952864.052 � 34996.156 ns/op
CriticalCalls.callPinned 100 avgt 30 30.640 � 0.173 ns/op
CriticalCalls.callPinned 10000 avgt 30 2241.403 � 35.473 ns/op
CriticalCalls.callPinned 1000000 avgt 30 221152.247 � 1697.968 ns/op
CriticalCalls.callRecycled 100 avgt 30 40.205 � 0.458 ns/op
CriticalCalls.callRecycled 10000 avgt 30 2845.316 � 13.331 ns/op
CriticalCalls.callRecycled 1000000 avgt 30 287752.178 � 2322.382 ns/op
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/16201#discussion_r1363661902
More information about the core-libs-dev
mailing list