[Integrated] [foreign-memaccess] RFR: Add benchmark to measure performance of VH adapters

Maurizio Cimadamore mcimadamore at openjdk.java.net
Mon May 18 17:10:27 UTC 2020


On Mon, 18 May 2020 13:09:53 GMT, Maurizio Cimadamore <mcimadamore at openjdk.org> wrote:

> This patch adds a straightforward benchmark to measure performances of var handle adapters.
> 
> The benchmark is set up to read values from an int array, both with a var handle(obtained from `MethodHandles`), an
> associated `MethodHandle` (derived from the first var handle) and with a segment-based, memory access var handle.
> Then the same test is repeated, but with an extra adaptation step inserted in the middle - rather than reading `int`
> values directly, the adapter turns `ints` into instances of `IntBox` and the loop code doing the sum converts them back
> into ints.
> Numbers are extremeluy solid on my machine:
> 
> TestAdaptVarHandles.mh_box_loop       avgt   30  0.306 ? 0.009  ms/op
> TestAdaptVarHandles.mh_loop           avgt   30  0.297 ? 0.009  ms/op
> TestAdaptVarHandles.segment_box_loop  avgt   30  0.308 ? 0.009  ms/op
> TestAdaptVarHandles.segment_loop      avgt   30  0.307 ? 0.008  ms/op
> TestAdaptVarHandles.vh_box_loop       avgt   30  0.296 ? 0.005  ms/op
> TestAdaptVarHandles.vh_loop           avgt   30  0.291 ? 0.003  ms/op
> 
> I thought it would have been nice to add this to our benchmark suites since we do not have anything that tests VH
> adaptation directly.

This pull request has now been integrated.

Changeset: e2d2dba6
Author:    Maurizio Cimadamore <mcimadamore at openjdk.org>
URL:       https://git.openjdk.java.net/panama-foreign/commit/e2d2dba6
Stats:     161 lines in 1 file changed: 0 ins; 161 del; 0 mod

Add benchmark to measure performance of VH adapters

Reviewed-by: jvernee, psandoz

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

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


More information about the panama-dev mailing list