Commit 6bee49dd authored by bak@chromium.org's avatar bak@chromium.org

- Changed the growth policy for hash tables to reduce the wasted memory.

  Now we fill hashtables 75% before expanding.
  
Review URL: http://codereview.chromium.org/660373

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@3994 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent d960bd2c
......@@ -6945,9 +6945,9 @@ Object* HashTable<Shape, Key>::EnsureCapacity(int n, Key key) {
int nof = NumberOfElements() + n;
int nod = NumberOfDeletedElements();
// Return if:
// 50% is still free after adding n elements and
// 25% is still free after adding n elements and
// at most 50% of the free elements are deleted elements.
if ((nof + (nof >> 1) <= capacity) &&
if ((nof + (nof >> 2) <= capacity) &&
(nod <= (capacity - nof) >> 1)) return this;
Object* obj = Allocate(nof * 2);
......
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