Commit b9995e03 authored by bak@chromium.org's avatar bak@chromium.org

Changed HashTable::EnsureCapacity to gurantee at least 50% of the entries are free (up from 25%).

This reduces the mount of probing in large hash tables.

Review URL: http://codereview.chromium.org/150017

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@2286 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 3ae01ab8
...@@ -6357,8 +6357,8 @@ Object* HashTable<prefix_size, element_size>::EnsureCapacity( ...@@ -6357,8 +6357,8 @@ Object* HashTable<prefix_size, element_size>::EnsureCapacity(
int n, HashTableKey* key) { int n, HashTableKey* key) {
int capacity = Capacity(); int capacity = Capacity();
int nof = NumberOfElements() + n; int nof = NumberOfElements() + n;
// Make sure 25% is free // Make sure 50% is free
if (nof + (nof >> 2) <= capacity) return this; if (nof + (nof >> 1) <= capacity) return this;
Object* obj = Allocate(nof * 2); Object* obj = Allocate(nof * 2);
if (obj->IsFailure()) return obj; if (obj->IsFailure()) return obj;
......
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