]> git.ipfire.org Git - thirdparty/git.git/commit - commit-graph.c
commit-graph: reduce initial oid allocation
authorDerrick Stolee <dstolee@microsoft.com>
Wed, 3 Oct 2018 17:12:19 +0000 (10:12 -0700)
committerJunio C Hamano <gitster@pobox.com>
Sat, 6 Oct 2018 23:25:05 +0000 (08:25 +0900)
commit53c36670e7f21342fb6017f39e0c91362e50dfe0
treeeeb88bd278089d942ca142a518fd4ba2c187f926
parent0bfb48e67230393632b9b07d8ffceae94398e5b8
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>
commit-graph.c