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

Re: [PATCH v2 2/2] list-objects: only look at cmdline trees with edge_hint

From
Junio C Hamano <gitster@pobox.com>
Date
Jan 21, 2014, 22:49 UTC
Message-ID
<xmqq8uu9t0gt.fsf@gitster.dls.corp.google.com>
In-Reply-To
<20140121022540.GB4672@sigill.intra.peff.net>
Jeff King <peff@peff.net> writes:
Show 13 quoted lines
> This tradeoff probably makes sense in the context of
> pack-objects, where we have set revs->edge_hint to have the
> traversal feed us the set of boundary objects.  For a
> regular rev-list, though, it is probably not a good
> tradeoff. It is true that it makes our list slightly closer
> to a true set difference, but it is a rare case where this
> is important. And because we do not have revs->edge_hint
> set, we do nothing useful with the larger set of boundary
> objects.
>
> 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.
Makes sense.  Thanks.  Will queue.
Show 47 quoted lines
>
> 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%
>
> Signed-off-by: Jeff King <peff@peff.net>
> ---
>  list-objects.c | 20 +++++++++++---------
>  1 file changed, 11 insertions(+), 9 deletions(-)
>
> diff --git a/list-objects.c b/list-objects.c
> index 6cbedf0..206816f 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 (!(obj->flags & SHOWN)) {
> +				obj->flags |= SHOWN;
> +				show_edge(commit);
> +			}
>  		}
>  	}
>  }
Previous: Jeff King
Message 13 of 13 in “performance regression in mark_edges_uninteresting”
  1. 0/2 performance regression in mark_edges_uninterestingJeff King, Jan 20, 2014
  2. 1/2 t/perf: time rev-list with UNINTERESTING commitsJeff King, Jan 20, 2014
  3. Jeff KingJan 20, 2014
  4. Thomas RastJan 20, 2014
  5. Jeff KingJan 20, 2014
  6. 2/2 list-objects: only look at cmdline trees with edge_hintJeff King, Jan 20, 2014
  7. Duy NguyenJan 20, 2014
  8. Jeff KingJan 21, 2014
  9. Jeff KingJan 20, 2014
  10. 0/2 performance regression in mark_edges_uninterestingJeff King, Jan 21, 2014
  11. 1/2 t/perf: time rev-list with UNINTERESTING commitsJeff King, Jan 21, 2014
  12. 2/2 list-objects: only look at cmdline trees with edge_hintJeff King, Jan 21, 2014
  13. Junio C HamanoJan 21, 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.