{"thread":{"id":"3455","subject":"git-annotate efficiency","startedAt":"2006-02-24T15:37:10Z","lastAt":"2006-02-24T19:42:31Z","messageCount":4,"participants":["Morten Welinder","Randal L. Schwartz","Ryan Anderson"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"16678","messageId":"118833cc0602240737i42acdc90sb8f93dde1a1bc035@mail.gmail.com","threadId":"3455","inReplyTo":null,"subject":"git-annotate efficiency","fromName":"Morten Welinder","fromEmail":"mwelinder@gmail.com","sentAt":"2006-02-24T15:37:10Z","receivedAt":"2006-02-24T15:37:10Z","isPatch":false,"sender":{"key":"mwelinder@gmail.com","avatar":null},"body":"So I wanted to give git-annotate a spin and typed...\n\n    git annotate Makefile\n\nBad idea.  It's been ten minutes and no output yet.  While the script only\nappears to use ~20% of cpu according to top, an strace shows that it\nspins off a huge number of very short-lived subprocesses.\n\nMorten\n\n\n\n\n...\nrt_sigaction(SIGQUIT, {SIG_IGN}, {SIG_DFL}, 8) = 0\nwaitpid(1539, [{WIFEXITED(s) && WEXITSTATUS(s) == 0}], 0) = 1539\n--- SIGCHLD (Child exited) @ 0 (0) ---\nrt_sigaction(SIGHUP, {SIG_DFL}, NULL, 8) = 0\nrt_sigaction(SIGINT, {SIG_DFL}, NULL, 8) = 0\nrt_sigaction(SIGQUIT, {SIG_DFL}, NULL, 8) = 0\npipe([3, 4])                            = 0\npipe([5, 6])                            = 0\nclone(child_stack=0,\nflags=CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCHLD,\nchild_tidptr=0x401db708) = 1540\nclose(6)                                = 0\nclose(4)                                = 0\nread(5, \"\", 4)                          = 0\nclose(5)                                = 0\nioctl(3, SNDCTL_TMR_TIMEBASE or TCGETS, 0xbfffc718) = -1 EINVAL\n(Invalid argument)\n_llseek(3, 0, 0xbfffc760, SEEK_CUR)     = -1 ESPIPE (Illegal seek)\nfcntl64(3, F_SETFD, FD_CLOEXEC)         = 0\nread(3, \"diff --git a/Makefile b/Makefile\"..., 4096) = 63\nread(3, \"--- a/Makefile\\n+++ b/Makefile\\n@@\"..., 4096) = 203\n--- SIGCHLD (Child exited) @ 0 (0) ---\nread(3, \"\", 4096)                       = 0\nclose(3)                                = 0\nrt_sigaction(SIGHUP, {SIG_IGN}, {SIG_DFL}, 8) = 0\nrt_sigaction(SIGINT, {SIG_IGN}, {SIG_DFL}, 8) = 0\n...\n"},{"id":"16691","messageId":"118833cc0602241000p4e4c8017u3e3afe76fbbd75a4@mail.gmail.com","threadId":"3455","inReplyTo":"118833cc0602240737i42acdc90sb8f93dde1a1bc035@mail.gmail.com","subject":"Re: git-annotate efficiency","fromName":"Morten Welinder","fromEmail":"mwelinder@gmail.com","sentAt":"2006-02-24T18:00:24Z","receivedAt":"2006-02-24T18:00:24Z","isPatch":false,"sender":{"key":"mwelinder@gmail.com","avatar":null},"body":"It looks like handle_rev is seeing the same revisions over and over again.\nI don't know why that would be, but the following patch just skips dups.\nI have no idea if it is right, though.\n\nMorten\n\n\ndiff --git a/git-annotate.perl b/git-annotate.perl\nindex 3800c46..a5e2d86 100755\n--- a/git-annotate.perl\n+++ b/git-annotate.perl\n@@ -117,7 +117,10 @@ sub init_claim {\n\n sub handle_rev {\n        my $i = 0;\n+       my %seen = ();\n        while (my $rev = shift @revqueue) {\n+               next if $seen{$rev};\n+               $seen{$rev} = 1;\n\n                my %revinfo = git_commit_info($rev);\n"},{"id":"16698","messageId":"86oe0wbmqn.fsf@blue.stonehenge.com","threadId":"3455","inReplyTo":"118833cc0602241000p4e4c8017u3e3afe76fbbd75a4@mail.gmail.com","subject":"Re: git-annotate efficiency","fromName":"Randal L. Schwartz","fromEmail":"merlyn@stonehenge.com","sentAt":"2006-02-24T19:06:08Z","receivedAt":"2006-02-24T19:06:08Z","isPatch":false,"sender":{"key":"merlyn@stonehenge.com","avatar":"https://gravatar.com/avatar/dc528d210743ff0333e6213f9ee7b33b23f1b7bc1f3c5a8c2d819074ecd7ab19?d=mp&s=160"},"body":">>>>> \"Morten\" == Morten Welinder <mwelinder@gmail.com> writes:\n\nMorten> It looks like handle_rev is seeing the same revisions over and over again.\nMorten> I don't know why that would be, but the following patch just skips dups.\nMorten> I have no idea if it is right, though.\n\nMorten> Morten\n\n\nMorten> diff --git a/git-annotate.perl b/git-annotate.perl\nMorten> index 3800c46..a5e2d86 100755\nMorten> --- a/git-annotate.perl\nMorten> +++ b/git-annotate.perl\nMorten> @@ -117,7 +117,10 @@ sub init_claim {\n\nMorten>  sub handle_rev {\nMorten>         my $i = 0;\nMorten> +       my %seen = ();\nMorten>         while (my $rev = shift @revqueue) {\nMorten> +               next if $seen{$rev};\nMorten> +               $seen{$rev} = 1;\n\nMorten>                 my %revinfo = git_commit_info($rev);\n\nThe traditional idiom for that is\n\n        next if $seen{$rev}++;\n\n-- \nRandal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095\n<merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>\nPerl/Unix/security consulting, Technical writing, Comedy, etc. etc.\nSee PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!\n"},{"id":"16701","messageId":"20060224194231.GA18691@mythryan2.michonline.com","threadId":"3455","inReplyTo":"118833cc0602241000p4e4c8017u3e3afe76fbbd75a4@mail.gmail.com","subject":"Re: git-annotate efficiency","fromName":"Ryan Anderson","fromEmail":"ryan@michonline.com","sentAt":"2006-02-24T19:42:31Z","receivedAt":"2006-02-24T19:42:31Z","isPatch":false,"sender":{"key":"ryan@michonline.com","avatar":null},"body":"On Fri, Feb 24, 2006 at 01:00:24PM -0500, Morten Welinder wrote:\n> It looks like handle_rev is seeing the same revisions over and over again.\n> I don't know why that would be, but the following patch just skips dups.\n> I have no idea if it is right, though.\n\nMerges.\n\na--b--c--d--f\n   \\-g--h--/\n\nIt would do f,d,c,b,a + f,h,g,b,a\n\nSo yes, this fix is correct, and Junio, I'll be doing some changes this\nweekend and send it along with a few other things.\n\n(On a medium-sized test tree at work with 3500 commits in the tree, 37\non the main Makefile (6 merges), this cuts the annotate time from 10s to a little\nover 2, so it's, umm, very worthwhile.)\n\n> \n> Morten\n> \n> \n> diff --git a/git-annotate.perl b/git-annotate.perl\n> index 3800c46..a5e2d86 100755\n> --- a/git-annotate.perl\n> +++ b/git-annotate.perl\n> @@ -117,7 +117,10 @@ sub init_claim {\n> \n>  sub handle_rev {\n>         my $i = 0;\n> +       my %seen = ();\n>         while (my $rev = shift @revqueue) {\n> +               next if $seen{$rev};\n> +               $seen{$rev} = 1;\n> \n>                 my %revinfo = git_commit_info($rev);\n> -\n> To unsubscribe from this list: send the line \"unsubscribe git\" in\n> the body of a message to majordomo@vger.kernel.org\n> More majordomo info at  http://vger.kernel.org/majordomo-info.html\n> \n\n-- \n\nRyan Anderson\n  sometimes Pug Majere\n"}]}