Reviewers: Vyacheslav Egorov,

Description:
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).

Please review this at https://chromiumcodereview.appspot.com/9323078/

SVN Base: http://v8.googlecode.com/svn/branches/bleeding_edge/

Affected files:
  M     src/list-inl.h


Index: src/list-inl.h
===================================================================
--- src/list-inl.h      (revision 10611)
+++ src/list-inl.h      (working copy)
@@ -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