Skip to content

Commit 4615e18

Browse files
committed
[stdlib] Force-inline trivial default implementations for hidden Sequence/Collection customization points
This is usually a code size pessimization, but in this case the bodies are trivial, so inlining them eliminates a call + a conditional branch.
1 parent 2f0f43a commit 4615e18

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

stdlib/public/core/Collection.swift

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1267,6 +1267,7 @@ extension Collection {
12671267
///
12681268
/// - Complexity: Hopefully less than O(`count`).
12691269
@inlinable
1270+
@inline(__always)
12701271
public // dispatching
12711272
func _customIndexOfEquatableElement(_: Element) -> Index?? {
12721273
return nil
@@ -1283,6 +1284,7 @@ extension Collection {
12831284
///
12841285
/// - Complexity: Hopefully less than O(`count`).
12851286
@inlinable
1287+
@inline(__always)
12861288
public // dispatching
12871289
func _customLastIndexOfEquatableElement(_ element: Element) -> Index?? {
12881290
return nil
@@ -1802,6 +1804,7 @@ extension Collection where SubSequence == Self {
18021804

18031805
extension Collection {
18041806
@inlinable
1807+
@inline(__always)
18051808
public func _preprocessingPass<R>(
18061809
_ preprocess: () throws -> R
18071810
) rethrows -> R? {

stdlib/public/core/Sequence.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -905,13 +905,15 @@ extension Sequence {
905905
}
906906

907907
@inlinable
908+
@inline(__always)
908909
public func _preprocessingPass<R>(
909910
_ preprocess: () throws -> R
910911
) rethrows -> R? {
911912
return nil
912913
}
913914

914915
@inlinable
916+
@inline(__always)
915917
public func _customContainsEquatableElement(
916918
_ element: Iterator.Element
917919
) -> Bool? {

0 commit comments

Comments
 (0)