Re: [PATCH 2/2] list-objects: only look at cmdline trees with edge_hint
- From
Duy Nguyen <pclouds@gmail.com>
- Date
- Jan 20, 2014, 23:57 UTC
- Message-ID
- <CACsJy8CBuW0dXgbSLgFHye9-aCDQCaK47MFpqeCh3m3JWHJOEw@mail.gmail.com>
- In-Reply-To
- <20140120213250.GB16095@sigill.intra.peff.net>
On Tue, Jan 21, 2014 at 4:32 AM, Jeff King <peff@peff.net> wrote:
Show 13 quoted lines
> This patch therefore ties the extra tree examination to the > revs->edge_hint flag; it is the presence of that flag that > makes the tradeoff worthwhile. > > Here is output from the p0001-rev-list showing the > improvement in performance: > > Test HEAD^ HEAD > ----------------------------------------------------------------------------------------- > 0001.1: rev-list --all 0.69(0.65+0.02) 0.69(0.66+0.02) +0.0% > 0001.2: rev-list --all --objects 3.22(3.19+0.03) 3.23(3.20+0.03) +0.3% > 0001.4: rev-list $commit --not --all 0.04(0.04+0.00) 0.04(0.04+0.00) +0.0% > 0001.5: rev-list --objects $commit --not --all 0.27(0.26+0.01) 0.04(0.04+0.00) -85.2%
You must have so much fun (or headache, depending on your view) with the variety of repos on github :)
Show 25 quoted lines
> diff --git a/list-objects.c b/list-objects.c
> index 6cbedf0..43ce1d9 100644
> --- a/list-objects.c
> +++ b/list-objects.c
> @@ -162,15 +162,17 @@ void mark_edges_uninteresting(struct rev_info *revs, show_edge_fn show_edge)
> }
> mark_edge_parents_uninteresting(commit, revs, show_edge);
> }
> - for (i = 0; i < revs->cmdline.nr; i++) {
> - struct object *obj = revs->cmdline.rev[i].item;
> - struct commit *commit = (struct commit *)obj;
> - if (obj->type != OBJ_COMMIT || !(obj->flags & UNINTERESTING))
> - continue;
> - mark_tree_uninteresting(commit->tree);
> - if (revs->edge_hint && !(obj->flags & SHOWN)) {
> - obj->flags |= SHOWN;
> - show_edge(commit);
> + if (revs->edge_hint) {
> + for (i = 0; i < revs->cmdline.nr; i++) {
> + struct object *obj = revs->cmdline.rev[i].item;
> + struct commit *commit = (struct commit *)obj;
> + if (obj->type != OBJ_COMMIT || !(obj->flags & UNINTERESTING))
> + continue;
> + mark_tree_uninteresting(commit->tree);
> + if (revs->edge_hint && !(obj->flags & SHOWN)) {Not really important, but perhaps remove revs->edge_hint here because it's already checked?
Show 6 quoted lines
> + obj->flags |= SHOWN; > + show_edge(commit); > + } > } > } > }
-- Duy