[foreign-memaccess] RFR: Add benchmark to measure performance of VH adapters
psandoz at openjdk.java.net
Mon May 18 17:02:10 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.
Marked as reviewed by psandoz (Committer).
More information about the panama-dev