RFR: 8268231: Aarch64: Use ldp in intrinsics for String.compareTo [v2]

Wang Huang whuang at openjdk.java.net
Tue Jul 13 03:32:55 UTC 2021


On Mon, 12 Jul 2021 15:36:29 GMT, Andrew Haley <aph at openjdk.org> wrote:

> And with longer strings, M1 and ThunderX2:
> 
> ```
> Benchmark                                       (diff_pos)  (size)  Mode  Cnt   Score   Error  Units
> StringCompare.compareLLDiffStrings                    1023    1024  avgt    3  50.849 ± 0.087  us/op
> StringCompare.compareLLDiffStringsWithLdp             1023    1024  avgt    3  23.676 ± 0.015  us/op
> StringCompare.compareLLDiffStringsWithRefactor        1023    1024  avgt    3  28.967 ± 0.168  us/op
> ```
> 
> ```
> StringCompare.compareLLDiffStrings                    1023    1024  avgt    3  98.681 ± 0.026  us/op
> StringCompare.compareLLDiffStringsWithLdp             1023    1024  avgt    3  82.576 ± 0.656  us/op
> StringCompare.compareLLDiffStringsWithRefactor        1023    1024  avgt    3  98.801 ± 0.321  us/op
> ```
> 
> LDP wins on M1 here, but on ThunderX2 it makes almost no difference at all. And how often are we comparing such long strings?
> I don't know what to think, really. It seems that we're near to a place where we're optimizing for micro-architecture, and I don't want to see that here. On the other hand, using LDP is not worse anywhere, so we should allow it.

Thank you for your suggestion. I inspect the result and find that the result of my first commit (c5e29b9fedae7e1d24056a6fae8aff04afeb3889) is better. Because of that , I will choose the version without refacting `compare_string_16_bytes_same` as the final version.

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

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


More information about the hotspot-compiler-dev mailing list