Bug 411061 nsAutoTArray uses an inefficient first-time allocation strategy r=bsmedberg a=schrep

This commit is contained in:
2008-01-19 05:47:46 -08:00
parent 9f72aee16f
commit ac0599d421

View File

@@ -82,11 +82,7 @@ nsTArray_base::EnsureCapacity(size_type capacity, size_type elemSize) {
}
// Use doubling algorithm when forced to increase available capacity.
NS_ASSERTION(mHdr->mCapacity > 0, "should not have buffer of zero size");
size_type temp = mHdr->mCapacity;
while (temp < capacity)
temp <<= 1;
capacity = temp;
capacity = PR_MAX(capacity, mHdr->mCapacity << 1);
Header *header;
if (UsesAutoArrayBuffer()) {