Skip to content

Commit 0102fe8

Browse files
committed
stdlib: remove some inlinable annotations from Substring's and String's subscript
Inlining those operations does not really give any benefit. Those operations are complex and most likely, cannot be folded into simpler patterns after inlining, anyway. Reduces some code size for cases where those functions were inlined (due to a not perfect inlining heuristics).
1 parent 6687fca commit 0102fe8

File tree

1 file changed

+1
-5
lines changed

1 file changed

+1
-5
lines changed

stdlib/public/core/Substring.swift

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -200,9 +200,8 @@ extension Substring: StringProtocol {
200200
return _slice.distance(from: start, to: end)
201201
}
202202

203-
@inlinable
204203
public subscript(i: Index) -> Character {
205-
@inline(__always) get { return _slice[i] }
204+
get { return _slice[i] }
206205
}
207206

208207
public mutating func replaceSubrange<C>(
@@ -322,7 +321,6 @@ extension Substring: CustomDebugStringConvertible {
322321
}
323322

324323
extension Substring: LosslessStringConvertible {
325-
@inlinable
326324
public init(_ content: String) {
327325
self = content[...]
328326
}
@@ -800,7 +798,6 @@ extension Substring: ExpressibleByStringLiteral {
800798

801799
// String/Substring Slicing
802800
extension String {
803-
@inlinable
804801
@available(swift, introduced: 4)
805802
public subscript(r: Range<Index>) -> Substring {
806803
_boundsCheck(r)
@@ -809,7 +806,6 @@ extension String {
809806
}
810807

811808
extension Substring {
812-
@inlinable
813809
@available(swift, introduced: 4)
814810
public subscript(r: Range<Index>) -> Substring {
815811
return Substring(_slice[r])

0 commit comments

Comments
 (0)