Re: Git is not scalable with too many refs/*
- From
- Martin Fick <mfick@codeaurora.org>
- Date
- Sep 30, 2011, 16:09 UTC
- Message-ID
- <201109301009.05583.mfick@codeaurora.org>
- In-Reply-To
- <4E8587E8.9070606@lsrfire.ath.cx>
On Friday, September 30, 2011 03:12:08 am René Scharfe wrote:
Show 5 quoted lines
> OK, and what happens if you apply the following patch on > top of my first one? It avoids going through all the > refs a second time during cleanup, at the cost of going > through the list of all known objects. I wonder if > that's any faster in your case.
This patch helps a bit more. It seems to shave about another .5s off in packed and non packed case w or w/o binary search.
-Martin
Show 11 quoted lines
> diff --git a/builtin/checkout.c b/builtin/checkout.c > index 84e0cdc..a4b1003 100644 > --- a/builtin/checkout.c > +++ b/builtin/checkout.c > @@ -596,15 +596,14 @@ static int > add_pending_uninteresting_ref(const char *refname, > return 0; > } > > -static int clear_commit_marks_from_one_ref(const char > *refname, - const unsigned
char *sha1,
Show 11 quoted lines
> - int flags,
> - void *cb_data)
> +static void clear_commit_marks_for_all(unsigned int
> mark) {
> - struct commit *commit =
> lookup_commit_reference_gently(sha1, 1); - if (commit)
> - clear_commit_marks(commit, -1);
> - return 0;
> + unsigned int i, max = get_max_object_index();
> + for (i = 0; i < max; i++) {
> + struct object *object = get_indexed_object(i);
Show 9 quoted lines
> + if (object && object->type == OBJ_COMMIT)
> + object->flags &= ~mark;
> + }
> }
>
> static void describe_one_orphan(struct strbuf *sb,
> struct commit *commit) @@ -690,8 +689,7 @@ static void
> orphaned_commit_warning(struct commit *commit) else
> describe_detached_head(_("Previous HEAD position
Show 13 quoted lines
> was"), commit); > > - clear_commit_marks(commit, -1); > - for_each_ref(clear_commit_marks_from_one_ref, NULL); > + clear_commit_marks_for_all(ALL_REV_FLAGS); > } > > static int switch_branches(struct checkout_opts *opts, > struct branch_info *new) -- > To unsubscribe from this list: send the line "unsubscribe > git" in the body of a message to > majordomo@vger.kernel.org More majordomo info at > http://vger.kernel.org/majordomo-info.html
-- Employee of Qualcomm Innovation Center, Inc. which is a member of Code Aurora Forum