Skip to content

Commit 7164260

Browse files
committed
stdlib: make Sequence -> String inlinable
As this function is generic, it makes a big difference when it can be specialized for concrete sequences, like arrays or unsafe buffers. This fixes a performance regression of String(decoding:as:), e.g. when constructing a String from a byte buffer.
1 parent bb77484 commit 7164260

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

stdlib/public/core/SmallString.swift

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -451,10 +451,7 @@ extension _SmallUTF8String {
451451

452452
// NOTE: This exists to facilitate _fromCodeUnits, which is awful for this use
453453
// case. Please don't call this from anywhere else.
454-
@usableFromInline
455-
@inline(never) // @outlined
456-
// @_specialize(where Encoding == UTF16)
457-
// @_specialize(where Encoding == UTF8)
454+
@inlinable
458455
init?<S: Sequence, Encoding: Unicode.Encoding>(
459456
_fromCodeUnits codeUnits: S,
460457
utf16Length: Int,

0 commit comments

Comments
 (0)