Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff Hostetler <jeffhost@microsoft.com>2017-03-22 20:14:20 +0300
committerJunio C Hamano <gitster@pobox.com>2017-03-22 23:41:41 +0300
commit16f9b4cdd31de2b8185c5c717efa6d28c56b3c74 (patch)
tree47eaff4a345e516eacb01aca97683630ab308c36 /name-hash.c
parent3b9e3c2cede15057af3ff8076c45ad5f33829436 (diff)
name-hash: specify initial size for istate.dir_hash table
Specify an initial size for the istate.dir_hash HashMap matching the size of the istate.name_hash. Previously hashmap_init() was given 0, causing a 64 bucket hashmap to be created. When working with very large repositories, this would cause numerous rehash() calls to realloc and rebalance the hashmap. This is especially true when the worktree is deep, with many directories containing a few files. Signed-off-by: Jeff Hostetler <jeffhost@microsoft.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'name-hash.c')
-rw-r--r--name-hash.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/name-hash.c b/name-hash.c
index 6d9f23e932..3f7722a63b 100644
--- a/name-hash.c
+++ b/name-hash.c
@@ -120,7 +120,8 @@ static void lazy_init_name_hash(struct index_state *istate)
return;
hashmap_init(&istate->name_hash, (hashmap_cmp_fn) cache_entry_cmp,
istate->cache_nr);
- hashmap_init(&istate->dir_hash, (hashmap_cmp_fn) dir_entry_cmp, 0);
+ hashmap_init(&istate->dir_hash, (hashmap_cmp_fn) dir_entry_cmp,
+ istate->cache_nr);
for (nr = 0; nr < istate->cache_nr; nr++)
hash_index_entry(istate, istate->cache[nr]);
istate->name_hash_initialized = 1;