Subject: [PATCH 06/11] object: growing the hash-table more aggressively does not help much

From: Junio C Hamano <[email-masked]>
Date: Thu, 11 Aug 2011 10:53:11 -0700

Signed-off-by: Junio C Hamano <[email-masked]>
---
../+v/2555c0d98970098861c97b7746f2b8846c823e6f/git-pack-objects
Counting objects: 2139209, done.
32.07user 1.96system 0:34.15elapsed 99%CPU (0avgtext+0avgdata 2966176maxresident)k
0inputs+0outputs (0major+225410minor)pagefaults 0swaps
Counting objects: 2139209, done.
31.89user 2.16system 0:34.16elapsed 99%CPU (0avgtext+0avgdata 2965264maxresident)k
0inputs+0outputs (0major+225336minor)pagefaults 0swaps
Counting objects: 2139209, done.
32.01user 2.12system 0:34.23elapsed 99%CPU (0avgtext+0avgdata 2964832maxresident)k
0inputs+0outputs (0major+225332minor)pagefaults 0swaps
---
 object.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/object.c b/object.c
index d95d7a6..c2c0a7d 100644
--- a/object.c
+++ b/object.c
@@ -83,7 +83,8 @@ struct object *lookup_object(const unsigned char *sha1)
 
 static int next_size(int sz)
 {
-	return sz < 32 ? 32 : 2 * sz;
+	return (sz < 32 ? 32 :
+		(sz < 1024 * 1024 ? 8 : 2) * sz);
 }
 
 static void grow_object_hash(void)
-- 
1.7.6.433.g1421f