RFR: 8321283: Reuse StringLatin1::equals in regionMatches
Chen Liang
liach at openjdk.org
Wed Nov 26 20:14:10 UTC 2025
On Sat, 2 Dec 2023 16:56:22 GMT, Francesco Nigro <duke at openjdk.org> wrote:
> This improvement has been found on https://github.com/vert-x3/vertx-web/pull/2526.
>
> It can potentially affect the existing ArraysSupport.mismatch caller code-path performance ie requires investigation.
With a JBS issue, you need to change the PR title to `8321283: Reuse StringLatin1::equals in regionMatches` so that the JDK bot will recognize and link the issue.
src/java.base/share/classes/java/lang/String.java line 2185:
> 2183: byte[] ov = other.value;
> 2184: if (coder == otherCoder) {
> 2185: if ((ooffset | toffset) == 0 && len == (tv.length >> coder) && ov.length == tv.length) {
Just curious, is `(ooffset | toffset) == 0` more efficient than `ooffset == 0 && toffset== 0`?
-------------
PR Comment: https://git.openjdk.org/jdk/pull/16933#issuecomment-1873586642
PR Review Comment: https://git.openjdk.org/jdk/pull/16933#discussion_r1414224254
More information about the core-libs-dev
mailing list