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:
authorDerrick Stolee <dstolee@microsoft.com>2018-10-03 20:12:19 +0300
committerJunio C Hamano <gitster@pobox.com>2018-10-07 02:25:05 +0300
commit53c36670e7f21342fb6017f39e0c91362e50dfe0 (patch)
treeeeb88bd278089d942ca142a518fd4ba2c187f926 /commit-graph.c
parent0bfb48e67230393632b9b07d8ffceae94398e5b8 (diff)
commit-graph: reduce initial oid allocation
While writing a commit-graph file, we store the full list of commits in a flat list. We use this list for sorting and ensuring we are closed under reachability. The initial allocation assumed that (at most) one in four objects is a commit. This is a dramatic over-count for many repos, especially large ones. Since we grow the repo dynamically, reduce this count by a factor of eight. We still set it to a minimum of 1024 before allocating. Signed-off-by: Derrick Stolee <dstolee@microsoft.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'commit-graph.c')
-rw-r--r--commit-graph.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/commit-graph.c b/commit-graph.c
index ceca6026b0..e773703e1d 100644
--- a/commit-graph.c
+++ b/commit-graph.c
@@ -720,7 +720,7 @@ void write_commit_graph(const char *obj_dir,
struct progress *progress = NULL;
oids.nr = 0;
- oids.alloc = approximate_object_count() / 4;
+ oids.alloc = approximate_object_count() / 32;
oids.progress = NULL;
oids.progress_done = 0;