[PATCH] list-objects: mark fewer commits as edges for non-shallow clones
- From
brian m. carlson <sandals@crustytoothpaste.net>
- Date
- Dec 11, 2014, 03:46 UTC
- Message-ID
- <1418269615-139571-1-git-send-email-sandals@crustytoothpaste.net>
- In-Reply-To
- <20141211030948.GA137226@vauxhall.crustytoothpaste.net>
In commit fbd4a70 (list-objects: mark more commits as edges in mark_edges_uninteresting - 2013-08-16), we made --thin much more aggressive by reading lots more trees. This produces much smaller packs for shallow clones; however, it causes a significant performance regression for non-shallow clones with lots of refs (23.322 seconds vs. 4.785 seconds with 22400 refs). Limit this extra edge-marking to shallow clones to avoid poor performance.
Suggested-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net> --- list-objects.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/list-objects.c b/list-objects.c index 2910bec..274ebb4 100644 --- a/list-objects.c +++ b/list-objects.c @@ -151,13 +151,14 @@ void mark_edges_uninteresting(struct rev_info *revs, show_edge_fn show_edge) { struct commit_list *list; int i; + int shallow = is_repository_shallow(); for (list = revs->commits; list; list = list->next) { struct commit *commit = list->item; if (commit->object.flags & UNINTERESTING) { mark_tree_uninteresting(commit->tree); - if (revs->edge_hint && !(commit->object.flags & SHOWN)) { + if (shallow && revs->edge_hint && !(commit->object.flags & SHOWN)) { commit->object.flags |= SHOWN; show_edge(commit); } @@ -165,6 +166,8 @@ void mark_edges_uninteresting(struct rev_info *revs, show_edge_fn show_edge) } mark_edge_parents_uninteresting(commit, revs, show_edge); } + if (!shallow) + return; if (revs->edge_hint) { for (i = 0; i < revs->cmdline.nr; i++) { struct object *obj = revs->cmdline.rev[i].item;
-- 2.2.0.rc0.207.ga3a616c