[foreign-memaccess] RFR: Add benchmark to measure performance of VH adapters
Maurizio Cimadamore
mcimadamore at openjdk.java.net
Mon May 18 13:15:05 UTC 2020
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.
-------------
Commit messages:
- Add benchmark to measure performance of VH adapters
Changes: https://git.openjdk.java.net/panama-foreign/pull/175/files
Webrev: https://webrevs.openjdk.java.net/panama-foreign/175/webrev.00
Stats: 161 lines in 1 file changed: 161 ins; 0 del; 0 mod
Patch: https://git.openjdk.java.net/panama-foreign/pull/175.diff
Fetch: git fetch https://git.openjdk.java.net/panama-foreign pull/175/head:pull/175
PR: https://git.openjdk.java.net/panama-foreign/pull/175
More information about the panama-dev
mailing list