Revision: 10613
Author:   [email protected]
Date:     Mon Feb  6 08:23:40 2012
Log:      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
http://code.google.com/p/v8/source/detail?r=10613

Modified:
 /branches/bleeding_edge/src/list-inl.h

=======================================
--- /branches/bleeding_edge/src/list-inl.h      Wed Oct 26 03:45:24 2011
+++ /branches/bleeding_edge/src/list-inl.h      Mon Feb  6 08:23:40 2012
@@ -72,9 +72,9 @@
 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;

--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev

Reply via email to