RFR: 8173585: Intrinsify StringLatin1.indexOf(char)

Andrew Haley aph at redhat.com
Fri Sep 11 15:59:00 UTC 2020


On 11/09/2020 11:23, Jason Tatton wrote:

> For the x86 implementation there may be two further improvements we
> can make in order to improve performance of both the StringUTF16 and
> StringLatin1 indexOf(char) intrinsics:
>
> 1. Make use of AVX-512 instructions.

Is this really a good idea?

  When the processor detects Intel AVX instructions, additional
  voltage is applied to the core. With the additional voltage applied,
  the processor could run hotter, requiring the operating frequency to
  be reduced to maintain operations within the TDP limits. The higher
  voltage is maintained for 1 millisecond after the last Intel AVX
  instruction completes, and then the voltage returns to the nominal
  TDP voltage level.

  https://computing.llnl.gov/tutorials/linux_clusters/intelAVXperformanceWhitePaper.pdf

So, if StringLatin1.indexOf(char) executes enough to make a difference
to any real-world program, the effect may well be to slow down the clock
for all of the code that does not use AVX.

> 2. For “short” Strings (see below), I think it may be possible to modify the existing algorithm to still use SSE SIMD
> instructions instead of a loop.

-- 
Andrew Haley  (he/him)
Java Platform Lead Engineer
Red Hat UK Ltd. <https://www.redhat.com>
https://keybase.io/andrewhaley
EAC8 43EB D3EF DB98 CC77 2FAD A5CD 6035 332F A671



More information about the core-libs-dev mailing list