JDK-8173585: Intrinsify StringLatin1.indexOf(char)

Roger Riggs Roger.Riggs at oracle.com
Tue Sep 8 14:54:00 UTC 2020


Hi Jason,

With respect to the increased ns/op in the utf16_mixed_char benchmark,
how should we understand the lower performance?

Thanks, Roger


On 9/8/20 8:02 AM, Tatton, Jason wrote:
> Hi Andrew, thank you for taking the time to review this.
>
> Since we have now moved to git, I have raised a new PR for this RFR:
>
> https://github.com/openjdk/jdk/pull/71
> https://bugs.openjdk.java.net/browse/JDK-8173585
>
> I have improved the micro benchmark in the ways which you and others have requested, namely:
> + The benchmark is now included in test/micro/org/openjdk/bench/java/lang as StringIndexOfChar (as advised by my colleagues here at AWS; Xin Liu and Volker Simonis).
> + Times are now in nanoseconds.
> + Terminating characters ('a') are in 66.666% of tested strings.
> + I have added four new benchmarks which operate on a random length strings (32 characters being the average) of type either StringLatin1 of StringUTF16 and call indexOf(char) or indexOf(String).
>
> I have included below the output of these four tests below:
>
> Without the new StringLatin1 indexOf(char) intrinsic:
>
> Benchmark                           Mode  Cnt      Score     Error  Units
> IndexOfBenchmark.latin1_mixed_char  avgt    5  26389.129 ± 182.581  ns/op
> IndexOfBenchmark.utf16_mixed_char   avgt    5  17885.383 ± 435.933  ns/op
>
>
> With the new StringLatin1 indexOf(char) intrinsic:
>
> Benchmark                           Mode  Cnt      Score     Error  Units
> IndexOfBenchmark.latin1_mixed_char  avgt    5  17875.185 ± 407.716  ns/op
> IndexOfBenchmark.utf16_mixed_char   avgt    5  18292.802 ± 167.306  ns/op
>
> The objective of the patch is to bring the performance of StringLatin1 indexOf(char) in line with StringUTF16 indexOf(char) for x86 and ARM64. We can see above that this has been achieved. Similar results were obtained when running on ARM.
>
> Regards,
> Jason



More information about the core-libs-dev mailing list