From 3d82e557aeb1f84012bae565845be9f15270d733 Mon Sep 17 00:00:00 2001 From: Ross McIlroy Date: Mon, 27 Mar 2017 12:08:44 +0100 Subject: [PATCH] Resize identity map by doubling instead of quadrupling. Perf-sheriffs please revert if this causes any performance regressions. BUG= Change-Id: I9ead7148e1e0146ece3614df49fd031dd1e357fe Reviewed-on: https://chromium-review.googlesource.com/445159 Commit-Queue: Ross McIlroy Reviewed-by: Ben Titzer Reviewed-by: Jochen Eisinger Cr-Commit-Position: refs/heads/master@{#44143} --- src/identity-map.cc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/identity-map.cc b/src/identity-map.cc index 14d4a850e1..45969a60a2 100644 --- a/src/identity-map.cc +++ b/src/identity-map.cc @@ -11,7 +11,7 @@ namespace v8 { namespace internal { static const int kInitialIdentityMapSize = 4; -static const int kResizeFactor = 4; +static const int kResizeFactor = 2; IdentityMapBase::~IdentityMapBase() { // Clear must be called by the subclass to avoid calling the virtual @@ -86,7 +86,8 @@ void* IdentityMapBase::DeleteIndex(int index) { size_--; DCHECK_GE(size_, 0); - if (size_ * kResizeFactor < capacity_ / kResizeFactor) { + if (capacity_ > kInitialIdentityMapSize && + size_ * kResizeFactor < capacity_ / kResizeFactor) { Resize(capacity_ / kResizeFactor); return ret_value; // No need to fix collisions as resize reinserts keys. }