git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[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
Previous: brian m. carlsonNext: Duy Nguyen
Message 8 of 14 in “Poor push performance with large number of refs”
  1. brian m. carlsonDec 10, 2014
  2. Shawn PearceDec 10, 2014
  3. brian m. carlsonDec 10, 2014
  4. push: add remote.pushThin to control thin pack generationbrian m. carlson, Dec 10, 2014
  5. brian m. carlsonDec 11, 2014
  6. Duy NguyenDec 11, 2014
  7. brian m. carlsonDec 11, 2014
  8. list-objects: mark fewer commits as edges for non-shallow clonesbrian m. carlson, Dec 11, 2014
  9. Duy NguyenDec 11, 2014
  10. brian m. carlsonDec 20, 2014
  11. Junio C HamanoDec 11, 2014
  12. Junio C HamanoDec 11, 2014
  13. brian m. carlsonDec 20, 2014
  14. Duy NguyenDec 10, 2014

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.