RFR: 8302163: Speed up various String comparison methods with ArraysSupport.mismatch
Alan Bateman
alanb at openjdk.org
Mon Feb 13 16:01:27 UTC 2023
On Mon, 13 Feb 2023 09:59:24 GMT, Claes Redestad <redestad at openjdk.org> wrote:
> We can improve various String methods such as `startsWith`, `endsWith` and `regionMatches` by leveraging the intrinsified mismatch methods in `ArraysSupport`.
src/java.base/share/classes/java/lang/String.java line 2272:
> 2270: toffset <<= coder;
> 2271: return ArraysSupport.mismatch(ta, toffset,
> 2272: pa, 0, pc) < 0;
`offset <<= coder` is only obvious if the reader knows the value of LATIN1, maybe it would be simpler to read if you kept "int to"?
-------------
PR: https://git.openjdk.org/jdk/pull/12528
More information about the core-libs-dev
mailing list