Skip to content

Commit 317e681

Browse files
committed
Mark more functions as @_inlineable to improve the performance of the stdlib in resilient mode
1 parent 251305e commit 317e681

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

stdlib/public/core/Comparable.swift

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,7 @@ extension Comparable {
183183
/// - Parameters:
184184
/// - lhs: A value to compare.
185185
/// - rhs: Another value to compare.
186+
@_inlineable
186187
public static func > (lhs: Self, rhs: Self) -> Bool {
187188
return rhs < lhs
188189
}
@@ -196,6 +197,7 @@ extension Comparable {
196197
/// - Parameters:
197198
/// - lhs: A value to compare.
198199
/// - rhs: Another value to compare.
200+
@_inlineable
199201
public static func <= (lhs: Self, rhs: Self) -> Bool {
200202
return !(rhs < lhs)
201203
}
@@ -211,6 +213,7 @@ extension Comparable {
211213
/// - rhs: Another value to compare.
212214
/// - Returns: `true` if `lhs` is greater than or equal to `rhs`; otherwise,
213215
/// `false`.
216+
@_inlineable
214217
public static func >= (lhs: Self, rhs: Self) -> Bool {
215218
return !(lhs < rhs)
216219
}

stdlib/public/core/Integers.swift.gyb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1633,6 +1633,7 @@ ${operatorComment(x.operator, False)}
16331633
// Heterogeneous non-masking shift in terms of shift-assignment
16341634
${operatorComment(x.nonMaskingOperator, False)}
16351635
@_semantics("optimize.sil.specialize.generic.partial.never")
1636+
@_inlineable
16361637
public static func ${x.nonMaskingOperator}<RHS: BinaryInteger>(
16371638
_ lhs: Self, _ rhs: RHS
16381639
) -> Self {
@@ -2184,6 +2185,7 @@ ${operatorComment(x.operator, False)}
21842185
// Heterogeneous masking shift
21852186
${operatorComment(x.operator, False)}
21862187
@_semantics("optimize.sil.specialize.generic.partial.never")
2188+
@_inlineable
21872189
public static func ${x.operator} <
21882190
Other : BinaryInteger
21892191
>(lhs: Self, rhs: Other) -> Self {

0 commit comments

Comments
 (0)