RFR: 8302163: Speed up various String comparison methods with ArraysSupport.mismatch [v2]
Claes Redestad
redestad at openjdk.org
Tue Feb 14 09:21:42 UTC 2023
On Mon, 13 Feb 2023 16:43:12 GMT, Eirik Bjorsnos <duke at openjdk.org> wrote:
> Case-insensitive regionMatches could be improved by using ArraysSupport.mismatch to skip over long common substrings:
I considered this but saw regressions similar to what you're getting for size = 6 and backed off. I think this might be a good future enhancement, with some care, but didn't want to encumber this RFE with a case that regresses small inputs (which tend to be more common in actual applications).
In similar constructs we have avoided doing the vectorized call in a loop since this could regress worst case inputs severely (an adversary example might be something like `regionMatches(true, "aaaaaaaaaaaaaaaaaaaaaa", 0, "aAaAaAaAaAaAaAa", 0, 15)` which will call mismatch 8 times on 15 byte of input).
-------------
PR: https://git.openjdk.org/jdk/pull/12528
More information about the core-libs-dev
mailing list