RFR: 8273681: Add Vector API vs Arrays.mismatch intrinsic benchmark

Paul Sandoz psandoz at openjdk.java.net
Mon Sep 13 18:22:50 UTC 2021


On Fri, 10 Sep 2021 08:32:02 GMT, Kartik Ohri <github.com+27751938+amCap1712 at openjdk.org> wrote:

> Hi all!
> 
> Please review this PR to add a benchmark comparing the performance of Arrays.mismatch intrinsic in the JDK with that of the Vector API. Kindly refer to this [thread] on panama-dev regarding some initial discussion about this benchmark. I have attached the [results] of the full benchmark run along with the [assembly] output of a shorter run I had done while analysing the results. The benchmarks were run against the latest build of panama-vector available from builds.shipilev.net.
> 
> Also, I have not added the copyright header to this file yet as I am an individual contributor (OCA signed) and do not know what to put there.
> 
> [thread]: https://mail.openjdk.java.net/pipermail/panama-dev/2021-September/014839.html
> [results]: https://github.com/openjdk/jdk/files/7142452/results.csv
> [assembly]:  https://github.com/openjdk/jdk/files/7142362/benchmarks.txt
> 
> Regards,
> Kartik

Benchmark looks good (assuming license is added).

test/micro/org/openjdk/bench/jdk/incubator/vector/ArrayMismatchBenchmark.java line 52:

> 50:     static final VectorSpecies<Long> LONG_SPECIES_PREFERRED = LongVector.SPECIES_PREFERRED;
> 51: 
> 52:     static final Random random = new Random();

We could use the recently added `RandomGenerator` instead in the spirit of encouraging the use of new and preferred APIs:

- remove the static field
- replace `FLOAT_SPECIES` with `DOUBLE_SPECIES`
- in `setup` create an instance `RandomGenerator rg = RandomGenerator.getDefault()`
- remove `createRandomFloats` and use `rg.doubles(...).toArray()`

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

PR: https://git.openjdk.java.net/jdk/pull/5459


More information about the core-libs-dev mailing list