Performance of FloatVector::pow vs. equivalent FloatVector::mul (oracle-jdk-19.0.2, Intel i7 8700B)

Alex K aklibisz at gmail.com
Mon Feb 27 04:01:59 UTC 2023


Hello,

I have a question, possibly a bug, to ask/report regarding performance with
the jdk.incubator.vector.FloatVector class.

Specifically, given a FloatVector fv, I've found that calling fv.mul(fv) is
~40x faster than calling fv.pow(2)

Here is an example JMH benchmark:
https://github.com/alexklibisz/site-projects/blob/782dcd53d3ee09c93f65b660c8ed4fd030a8889a/jdk-incubator-vector-optimizations/src/main/scala/com/alexklibisz/BenchPowVsMul.scala

The results look like this, on my 2018 Mac Mini, w/ Intel i7 8700B, running
oracle-jdk-19.0.2:

[image: image.png]

As far as I can tell, the two operations produce equivalent results, yet
one is significantly faster than the other.

I'm eager to learn if this is expected, a regression, or something else.

Thanks,
Alex Klibisz
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/panama-dev/attachments/20230226/9bf6782f/attachment-0001.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image.png
Type: image/png
Size: 64712 bytes
Desc: not available
URL: <https://mail.openjdk.org/pipermail/panama-dev/attachments/20230226/9bf6782f/image-0001.png>


More information about the panama-dev mailing list