mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
[stdlib] Factor out Array growth calculation
This enables testing of other growth factors, per <rdar://problem/17230502>. See the radar for basic performance test results confirming (to the degree practical) that 2x growth is better than 1.5x in our current system. Swift SVN r18990
This commit is contained in:
@@ -315,8 +315,10 @@ func += <
|
||||
(lhs.elementStorage + oldCount).initializeFrom(rhs)
|
||||
}
|
||||
else {
|
||||
let newLHS = ContiguousArrayBuffer<T>(count: newCount,
|
||||
minimumCapacity: lhs.capacity * 2)
|
||||
let newLHS = ContiguousArrayBuffer<T>(
|
||||
count: newCount,
|
||||
minimumCapacity: _growArrayCapacity(lhs.capacity))
|
||||
|
||||
if lhs._base {
|
||||
newLHS.elementStorage.moveInitializeFrom(lhs.elementStorage,
|
||||
count: oldCount)
|
||||
|
||||
Reference in New Issue
Block a user