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

Re: rs/commit-list-sort-in-batch

From
Jeff King <peff@peff.net>
Date
Apr 7, 2012, 07:32 UTC
Message-ID
<20120407073232.GA13076@sigill.intra.peff.net>
In-Reply-To
<20120407072724.GA818@sigill.intra.peff.net>
On Sat, Apr 07, 2012 at 03:27:24AM -0400, Jeff King wrote:
Show 11 quoted lines
> On Fri, Apr 06, 2012 at 02:02:56PM -0700, Junio C Hamano wrote:
> 
> > * rs/commit-list-sort-in-batch (2012-04-02) 3 commits
> >  - revision: insert unsorted, then sort in prepare_revision_walk()
> >  - commit: use mergesort() in commit_list_sort_by_date()
> >  - add mergesort() for linked lists
> 
> Looks like you applied these patches right on v1.7.9. However, they need
> Thomas's 5e8617f to compile, which comes later. There's no textual
> conflict, but test-mergesort.c need strbuf_getwholeline_fd, which is
> made public by 5e8617f.

By the way, building on top of René's patches[1], I was able to drop the time of a particular fetch into a repository with many refs from:

    real    0m2.081s
    user    0m2.180s
    sys     0m0.712s
to:
    real    0m1.784s
    user    0m1.936s
    sys     0m0.652s
with this patch:
diff --git a/builtin/fetch-pack.c b/builtin/fetch-pack.c
index 7124c4b..5d80e65 100644
--- a/builtin/fetch-pack.c
+++ b/builtin/fetch-pack.c
@@ -503,7 +503,7 @@ static int mark_complete(const char *refname, const unsigned char *sha1, int fla
 		struct commit *commit = (struct commit *)o;
 		if (!(commit->object.flags & COMPLETE)) {
 			commit->object.flags |= COMPLETE;
-			commit_list_insert_by_date(commit, &complete);
+			commit_list_insert(commit, &complete);
 		}
 	}
 	return 0;
@@ -615,6 +615,7 @@ static int everything_local(struct ref **refs, int nr_match, char **match)
 	if (!args.depth) {
 		for_each_ref(mark_complete, NULL);
 		for_each_alternate_ref(mark_alternate_complete, NULL);
+		commit_list_sort_by_date(&complete);
 		if (cutoff)
 			mark_recent_complete_commits(cutoff);
 	}

I'm not sure if that vindicates the patches, or implies that these
things are lurking everywhere and that we should really move to a better
data structure so we don't have to fix them all manually. :)

-Peff

[1] Actually, it was René's patches merged into v1.7.10. My ccdc603
    (parse_object: try internal cache before reading object db,
    2012-01-05) makes such a huge difference it is not worth timing
    without it.
Previous: Jeff KingNext: Junio C Hamano
Message 3 of 4 in “What's cooking in git.git (Apr 2012, #03; Fri, 6)”
  1. Junio C HamanoApr 6, 2012
  2. rs/commit-list-sort-in-batchJeff King, Apr 7, 2012
  3. Jeff KingApr 7, 2012
  4. Junio C HamanoApr 9, 2012

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.