mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
[string] Skip unnecessary self UTF-16 length in isEqual
For isEqual bridging comparisons, skip checking our own UTF-16 length when the string we're comparing against is known to be ASCII.
This commit is contained in:
@@ -531,6 +531,8 @@ extension String.UTF16View {
|
||||
let idx = _utf16AlignNativeIndex(idx)
|
||||
|
||||
guard _guts._useBreadcrumbs(forEncodedOffset: idx._encodedOffset) else {
|
||||
// TODO: Generic _distance is still very slow. We should be able to
|
||||
// skip over ASCII substrings quickly
|
||||
return _distance(from: startIndex, to: idx)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user