Skip to content

Commit 201c542

Browse files
authored
Merge pull request #67071 from Catfish-Man/revert-append-fastpath
Revert #66838
2 parents 966590d + 6a954f5 commit 201c542

File tree

1 file changed

+4
-9
lines changed

1 file changed

+4
-9
lines changed

stdlib/public/core/RangeReplaceableCollection.swift

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -453,15 +453,10 @@ extension RangeReplaceableCollection {
453453
@inlinable
454454
public mutating func append<S: Sequence>(contentsOf newElements: __owned S)
455455
where S.Element == Element {
456-
457-
let done:Void? = newElements.withContiguousStorageIfAvailable {
458-
replaceSubrange(endIndex..<endIndex, with: $0)
459-
}
460-
461-
if done == nil {
462-
for element in newElements {
463-
append(element)
464-
}
456+
let approximateCapacity = self.count + newElements.underestimatedCount
457+
self.reserveCapacity(approximateCapacity)
458+
for element in newElements {
459+
append(element)
465460
}
466461
}
467462

0 commit comments

Comments
 (0)