mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-28 07:14:30 +02:00
8302163: Speed up various String comparison methods with ArraysSupport.mismatch
Reviewed-by: stsypanov, rriggs, alanb
This commit is contained in:
parent
50dcc2aec5
commit
861e302011
5 changed files with 127 additions and 64 deletions
|
@ -109,12 +109,8 @@ final class StringLatin1 {
|
|||
|
||||
public static int compareTo(byte[] value, byte[] other, int len1, int len2) {
|
||||
int lim = Math.min(len1, len2);
|
||||
for (int k = 0; k < lim; k++) {
|
||||
if (value[k] != other[k]) {
|
||||
return getChar(value, k) - getChar(other, k);
|
||||
}
|
||||
}
|
||||
return len1 - len2;
|
||||
int k = ArraysSupport.mismatch(value, other, lim);
|
||||
return (k < 0) ? len1 - len2 : getChar(value, k) - getChar(other, k);
|
||||
}
|
||||
|
||||
@IntrinsicCandidate
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue