[foreign-memaccess+abi] RFR: Generalize PointerInvoke to benchmark by-ref segment return [v2]

Maurizio Cimadamore mcimadamore at openjdk.org
Fri Feb 10 18:37:08 UTC 2023


On Fri, 10 Feb 2023 18:32:12 GMT, Maurizio Cimadamore <mcimadamore at openjdk.org> wrote:

>> I've generalized an existing benchmark to test by-reference segment return in downcalls.
>> Ideally, we should see scalarization of the returned segment, and no GC activity.
>
> Maurizio Cimadamore has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Fix benchmark not to let returned segments escape

Doh - realized that my benchmark was escaping segments "by design" (since the benchmark methods were returning the segments). I've tweaked the benchmark to return the `address()` value of the returned segment instead and it all got much better :-)


Benchmark                                                  Mode  Cnt   Score    Error   Units
PointerInvoke.long_to_long                                 avgt   30   9.764 ±  0.133   ns/op
PointerInvoke.long_to_long:·gc.alloc.rate                  avgt   30   0.001 ±  0.001  MB/sec
PointerInvoke.long_to_long:·gc.alloc.rate.norm             avgt   30  ≈ 10⁻⁵             B/op
PointerInvoke.long_to_long:·gc.count                       avgt   30     ≈ 0           counts
PointerInvoke.long_to_ptr                                  avgt   30   9.832 ±  0.122   ns/op
PointerInvoke.long_to_ptr:·gc.alloc.rate                   avgt   30   0.001 ±  0.001  MB/sec
PointerInvoke.long_to_ptr:·gc.alloc.rate.norm              avgt   30  ≈ 10⁻⁵             B/op
PointerInvoke.long_to_ptr:·gc.count                        avgt   30     ≈ 0           counts
PointerInvoke.ptr_to_long                                  avgt   30  11.069 ±  0.095   ns/op
PointerInvoke.ptr_to_long:·gc.alloc.rate                   avgt   30   0.001 ±  0.001  MB/sec
PointerInvoke.ptr_to_long:·gc.alloc.rate.norm              avgt   30  ≈ 10⁻⁵             B/op
PointerInvoke.ptr_to_long:·gc.count                        avgt   30     ≈ 0           counts
PointerInvoke.ptr_to_long_new_segment                      avgt   30  11.679 ±  0.160   ns/op
PointerInvoke.ptr_to_long_new_segment:·gc.alloc.rate       avgt   30   0.001 ±  0.001  MB/sec
PointerInvoke.ptr_to_long_new_segment:·gc.alloc.rate.norm  avgt   30  ≈ 10⁻⁵             B/op
PointerInvoke.ptr_to_long_new_segment:·gc.count            avgt   30     ≈ 0           counts
PointerInvoke.ptr_to_ptr                                   avgt   30  10.822 ±  0.141   ns/op
PointerInvoke.ptr_to_ptr:·gc.alloc.rate                    avgt   30   0.001 ±  0.001  MB/sec
PointerInvoke.ptr_to_ptr:·gc.alloc.rate.norm               avgt   30  ≈ 10⁻⁵             B/op
PointerInvoke.ptr_to_ptr:·gc.count                         avgt   30     ≈ 0           counts
PointerInvoke.ptr_to_ptr_new_segment                       avgt   30  11.772 ±  0.094   ns/op
PointerInvoke.ptr_to_ptr_new_segment:·gc.alloc.rate        avgt   30   0.001 ±  0.001  MB/sec
PointerInvoke.ptr_to_ptr_new_segment:·gc.alloc.rate.norm   avgt   30  ≈ 10⁻⁵             B/op
PointerInvoke.ptr_to_ptr_new_segment:·gc.count             avgt   30     ≈ 0           counts

None of the benchmark shows allocation now.

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

PR: https://git.openjdk.org/panama-foreign/pull/788


More information about the panama-dev mailing list