Merge branch 'jm/cache-entry-from-mem-pool'
authorJunio C Hamano <gitster@pobox.com>
Thu, 2 Aug 2018 22:30:43 +0000 (15:30 -0700)
committerJunio C Hamano <gitster@pobox.com>
Thu, 2 Aug 2018 22:30:43 +0000 (15:30 -0700)
For a large tree, the index needs to hold many cache entries
allocated on heap. These cache entries are now allocated out of a
dedicated memory pool to amortize malloc(3) overhead.

* jm/cache-entry-from-mem-pool:
block alloc: add validations around cache_entry lifecyle
block alloc: allocate cache entries from mem_pool
mem-pool: fill out functionality
mem-pool: add life cycle management functions
mem-pool: only search head block for available space
block alloc: add lifecycle APIs for cache_entry structs
read-cache: teach make_cache_entry to take object_id
read-cache: teach refresh_cache_entry to take istate

12 files changed:
1  2 
apply.c
blame.c
builtin/checkout.c
builtin/difftool.c
builtin/reset.c
builtin/update-index.c
cache.h
git.c
merge-recursive.c
read-cache.c
tree.c
unpack-trees.c
diff --cc apply.c
index 49752cde44df6f0853051abacf8546ab92ee4d7a,ee6c406c7a9fc5c402736bd504879f35ec1925dc..2594927248b44715054d8a52faeb2cd3948c2d30
+++ b/apply.c
@@@ -4266,9 -4263,11 +4266,8 @@@ static int add_index_file(struct apply_
        struct stat st;
        struct cache_entry *ce;
        int namelen = strlen(path);
-       unsigned ce_size = cache_entry_size(namelen);
  
-       ce = xcalloc(1, ce_size);
 -      if (!state->update_index)
 -              return 0;
 -
+       ce = make_empty_cache_entry(&the_index, namelen);
        memcpy(ce->name, path, namelen);
        ce->ce_mode = create_ce_mode(mode);
        ce->ce_flags = create_ce_flags(0);
diff --cc blame.c
Simple merge
Simple merge
Simple merge
diff --cc builtin/reset.c
Simple merge
Simple merge
diff --cc cache.h
Simple merge
diff --cc git.c
Simple merge
Simple merge
diff --cc read-cache.c
Simple merge
diff --cc tree.c
Simple merge
diff --cc unpack-trees.c
Simple merge