mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Reimplement the CF stub system using ObjC. The primary effect of this is to break the link-time dependency on the CF symbols, but it also improves performance a bit.
One additional tweak (setting the scalar-aligned bit on foreign indices) had to be made to avoid a performance regression for long non-ASCII foreign strings.
This commit is contained in:
@@ -423,7 +423,7 @@ extension String.UTF8View {
|
||||
|
||||
if utf8Len == 1 {
|
||||
_internalInvariant(idx.transcodedOffset == 0)
|
||||
return idx.nextEncoded
|
||||
return idx.nextEncoded._scalarAligned
|
||||
}
|
||||
|
||||
// Check if we're still transcoding sub-scalar
|
||||
@@ -432,7 +432,8 @@ extension String.UTF8View {
|
||||
}
|
||||
|
||||
// Skip to the next scalar
|
||||
return idx.encoded(offsetBy: scalarLen)
|
||||
_internalInvariant(idx.transcodedOffset == utf8Len - 1)
|
||||
return idx.encoded(offsetBy: scalarLen)._scalarAligned
|
||||
}
|
||||
|
||||
@usableFromInline @inline(never)
|
||||
|
||||
Reference in New Issue
Block a user