[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:
Dave Abrahams
2014-06-18 23:17:06 +00:00
parent 5c09ca5ee5
commit 89fb9c8bea
3 changed files with 13 additions and 6 deletions

View File

@@ -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)