Skip to content

Commit 0868f28

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 713eb1a commit 0868f28

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
@@ -464,10 +464,7 @@ extension _SmallUTF8String {
464464

465465
// NOTE: This exists to facilitate _fromCodeUnits, which is awful for this use
466466
// case. Please don't call this from anywhere else.
467-
@usableFromInline
468-
@inline(never) // @outlined
469-
// @_specialize(where Encoding == UTF16)
470-
// @_specialize(where Encoding == UTF8)
467+
@inlinable
471468
init?<S: Sequence, Encoding: Unicode.Encoding>(
472469
_fromCodeUnits codeUnits: S,
473470
utf16Length: Int,

0 commit comments

Comments
 (0)