Vectorized latin1 equalsIgnoreCase

Eirik Bjørsnøs eirbjo at gmail.com
Tue Feb 21 10:56:21 UTC 2023


Hi,

I've been working on https://github.com/openjdk/jdk/pull/12623 (which
speeds up latin1 equalsIgnoreCase using 'the oldest ASCII trick in the
book).

I was thinking that this trick could lend itself to vectorization, so I
made a quick exploration using the Vector API. (JMH results below)

While a vectorized implementation is out of scope for the current PR,
perhaps it could be useful to include this benchmark along the Vector API
benchmarks?

It's my first time writing Vector API code (or any SIMD code at all), so
this could probably be improved (a lot!):

https://github.com/openjdk/jdk/compare/master...eirbjo:jdk:vectorized-equalsignorecase

Let me know if there is interest in including this, and I can go ahead and
make a PR.

Cheers,
Eirik.


Results:

Benchmark                             (size)  Mode  Cnt     Score   Error
 Units
EqualsIgnoreCaseBenchmark.scalar          16  avgt   15    20.671 ± 0.718
 ns/op
EqualsIgnoreCaseBenchmark.scalar          32  avgt   15    46.155 ± 3.258
 ns/op
EqualsIgnoreCaseBenchmark.scalar          64  avgt   15    68.248 ± 1.767
 ns/op
EqualsIgnoreCaseBenchmark.scalar         128  avgt   15   148.948 ± 0.890
 ns/op
EqualsIgnoreCaseBenchmark.scalar        1024  avgt   15  1090.708 ± 7.540
 ns/op
EqualsIgnoreCaseBenchmark.vectorized      16  avgt   15    21.872 ± 0.232
 ns/op
EqualsIgnoreCaseBenchmark.vectorized      32  avgt   15    11.378 ± 0.097
 ns/op
EqualsIgnoreCaseBenchmark.vectorized      64  avgt   15    13.703 ± 0.135
 ns/op
EqualsIgnoreCaseBenchmark.vectorized     128  avgt   15    21.632 ± 0.735
 ns/op
EqualsIgnoreCaseBenchmark.vectorized    1024  avgt   15   105.509 ± 7.493
 ns/op
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/panama-dev/attachments/20230221/96ec4134/attachment.htm>


More information about the panama-dev mailing list