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

Wu Yan wuyan at openjdk.java.net
Fri Jul 30 06:49:30 UTC 2021


On Wed, 28 Jul 2021 09:55:18 GMT, Nick Gasson <ngasson at openjdk.org> wrote:

> Adding prefetches was one of the reasons to introduce the separate stub for long strings, see the mail below:
> 
> https://mail.openjdk.java.net/pipermail/hotspot-compiler-dev/2018-April/028888.html


Thank you for pointing this out, we didn't find that adding prefetches was one of the reasons for that optimization before.  

> Did you find there's no benefit to that?

In fact, at first we tested and found that adding prefetch would make it worse in some cases, so we removed prefetch in the LDP version, but after more testing, we found that prefetch is not the cause of the performance degradation. Sorry for this, please ignore the prefetch problem,  I will add prefetch back next.


> We don't really want to have different implementations for each microarchitecture, that would be a testing nightmare.

I aggree. This is the compromise solution that the optimization has no effect (or even slowdown) on some platforms. 
In addition, I found that in [JDK-8202326](https://bugs.openjdk.java.net/browse/JDK-8202326), adding prefetches is only for long strings (the rare cases), maybe we can further optimize longs string with LDP. So should I continue this optimization or close it.

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

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


More information about the core-libs-dev mailing list