Grow lists by a factor of 2 instead of 1.5 on a resize.

For zone lists this avoids resizing and reduces overall allocation
in most cases (especially for small lists).
Review URL: https://chromiumcodereview.appspot.com/9323078

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@10613 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent c142bc4c
......@@ -72,9 +72,9 @@ void List<T, P>::ResizeAdd(const T& element) {
template<typename T, class P>
void List<T, P>::ResizeAddInternal(const T& element) {
ASSERT(length_ >= capacity_);
// Grow the list capacity by 50%, but make sure to let it grow
// Grow the list capacity by 100%, but make sure to let it grow
// even when the capacity is zero (possible initial case).
int new_capacity = 1 + capacity_ + (capacity_ >> 1);
int new_capacity = 1 + 2 * capacity_;
// Since the element reference could be an element of the list, copy
// it out of the old backing storage before resizing.
T temp = element;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment