Skip to content

Commit 4f016c9

Browse files
committed
[stdlib] Make MutableCollection.partition(by:) implementation inlinable
The default `partition(by:)` implementation cannot currently be specialized, which makes it ~64-100x slower than it could be for common cases. (E.g., `Array<Int>.partition(by: { $0 >= foo})` is slower than `.sort()` by a factor of 2-32.) Make the implementation inlinable.
1 parent 65a9052 commit 4f016c9

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

stdlib/public/core/CollectionAlgorithms.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -330,8 +330,8 @@ extension MutableCollection where Self: BidirectionalCollection {
330330
return try _partitionImpl(by: belongsInSecondPartition)
331331
}
332332
}
333-
334-
@usableFromInline
333+
334+
@inlinable
335335
internal mutating func _partitionImpl(
336336
by belongsInSecondPartition: (Element) throws -> Bool
337337
) rethrows -> Index {

0 commit comments

Comments
 (0)