File tree Expand file tree Collapse file tree 1 file changed +11
-0
lines changed Expand file tree Collapse file tree 1 file changed +11
-0
lines changed Original file line number Diff line number Diff line change @@ -104,6 +104,17 @@ private func _stringCompareFastUTF8(
104
104
bothNFC: Bool
105
105
) -> Bool {
106
106
if _fastPath ( bothNFC) {
107
+ /*
108
+ If we know both Strings are NFC *and* we're just checking
109
+ equality, then we can early-out without looking at the contents
110
+ if the UTF8 counts are different (without the NFC req, equal
111
+ characters can have different counts). It might be nicer to do
112
+ this in _binaryCompare, but we have the information about what
113
+ operation we're trying to do at this level.
114
+ */
115
+ if expecting == . equal && utf8Left. count != utf8Right. count {
116
+ return false
117
+ }
107
118
let cmp = _binaryCompare ( utf8Left, utf8Right)
108
119
return _lexicographicalCompare ( cmp, 0 , expecting: expecting)
109
120
}
You can’t perform that action at this time.
0 commit comments