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

Re: git-annotate efficiency

From
RARyan Anderson <ryan@michonline.com>
Date
Feb 24, 2006, 19:42 UTC
Message-ID
<20060224194231.GA18691@mythryan2.michonline.com>
In-Reply-To
<118833cc0602241000p4e4c8017u3e3afe76fbbd75a4@mail.gmail.com>
On Fri, Feb 24, 2006 at 01:00:24PM -0500, Morten Welinder wrote:
> It looks like handle_rev is seeing the same revisions over and over again.
> I don't know why that would be, but the following patch just skips dups.
> I have no idea if it is right, though.
Merges.
a--b--c--d--f
   \-g--h--/
It would do f,d,c,b,a + f,h,g,b,a

So yes, this fix is correct, and Junio, I'll be doing some changes this weekend and send it along with a few other things.

(On a medium-sized test tree at work with 3500 commits in the tree, 37 on the main Makefile (6 merges), this cuts the annotate time from 10s to a little over 2, so it's, umm, very worthwhile.)

Show 23 quoted lines
> 
> Morten
> 
> 
> diff --git a/git-annotate.perl b/git-annotate.perl
> index 3800c46..a5e2d86 100755
> --- a/git-annotate.perl
> +++ b/git-annotate.perl
> @@ -117,7 +117,10 @@ sub init_claim {
> 
>  sub handle_rev {
>         my $i = 0;
> +       my %seen = ();
>         while (my $rev = shift @revqueue) {
> +               next if $seen{$rev};
> +               $seen{$rev} = 1;
> 
>                 my %revinfo = git_commit_info($rev);
> -
> 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
> 
-- 
Ryan Anderson
  sometimes Pug Majere
Previous: Randal L. Schwartz
Message 4 of 4 in “git-annotate efficiency”
  1. Morten WelinderFeb 24, 2006
  2. Morten WelinderFeb 24, 2006
  3. Randal L. SchwartzFeb 24, 2006
  4. Ryan AndersonFeb 24, 2006

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.