Skip to content

Commit 20bb815

Browse files
authored
Merge pull request #19683 from lorentey/inline-customization-points
[stdlib] Force-inline some Sequence/Collection customization points
2 parents 6b2d65e + 4615e18 commit 20bb815

File tree

4 files changed

+11
-0
lines changed

4 files changed

+11
-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/Dictionary.swift

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1383,16 +1383,19 @@ extension Dictionary {
13831383
}
13841384

13851385
@inlinable
1386+
@inline(__always)
13861387
public func _customContainsEquatableElement(_ element: Element) -> Bool? {
13871388
return _variant.contains(element)
13881389
}
13891390

13901391
@inlinable
1392+
@inline(__always)
13911393
public func _customIndexOfEquatableElement(_ element: Element) -> Index?? {
13921394
return Optional(_variant.index(forKey: element))
13931395
}
13941396

13951397
@inlinable
1398+
@inline(__always)
13961399
public func _customLastIndexOfEquatableElement(_ element: Element) -> Index?? {
13971400
// The first and last elements are the same because each element is unique.
13981401
return _customIndexOfEquatableElement(element)

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? {

stdlib/public/core/Set.swift

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -266,6 +266,7 @@ extension Set: Sequence {
266266
}
267267

268268
@inlinable
269+
@inline(__always)
269270
public func _customContainsEquatableElement(_ member: Element) -> Bool? {
270271
return contains(member)
271272
}
@@ -361,13 +362,15 @@ extension Set: Collection {
361362
}
362363

363364
@inlinable
365+
@inline(__always)
364366
public func _customIndexOfEquatableElement(
365367
_ member: Element
366368
) -> Index?? {
367369
return Optional(firstIndex(of: member))
368370
}
369371

370372
@inlinable
373+
@inline(__always)
371374
public func _customLastIndexOfEquatableElement(
372375
_ member: Element
373376
) -> Index?? {

0 commit comments

Comments
 (0)