Skip to content

Commit 50f7ea5

Browse files
committed
stdlib: improve existential collection performance for -Osize.
Making sure that makeIterator is always inlined, enables devirutalization of the iterator calls. Inlining was not done with -Osize which resulted in pretty bad performance when iterating over an existential collection.
1 parent 72038b5 commit 50f7ea5

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

stdlib/public/core/ExistentialCollection.swift.gyb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -413,6 +413,7 @@ internal final class _${Kind}Box<S : ${Kind}> : _Any${Kind}Box<S.Iterator.Elemen
413413
{
414414
internal typealias Element = S.Element
415415

416+
@inline(__always)
416417
@inlinable
417418
internal override func _makeIterator() -> AnyIterator<Element> {
418419
return AnyIterator(_base.makeIterator())
@@ -710,6 +711,7 @@ extension Any${Kind} {
710711
% else:
711712
/// Returns an iterator over the elements of this collection.
712713
% end
714+
@inline(__always)
713715
@inlinable
714716
public func makeIterator() -> Iterator {
715717
return _box._makeIterator()

0 commit comments

Comments
 (0)