threads / patch / 4723

patchSpeed up history generation

Subject: [PATCH] Speed up history generation

## tl;dr

6 messages between Jul 1, 2006 and Jul 1, 2006. Diffs are folded; open one to read it.

replies: 5people: 3as markdown or json

Luben Tuikov· Jul 1, 2006, 00:59 UTC · lore
Speed up history generation as suggested by Linus.
Signed-off-by: Luben Tuikov <ltuikov@yahoo.com>
---
 gitweb/gitweb.cgi |    9 ++-------
 1 files changed, 2 insertions(+), 7 deletions(-)
Show changes to gitweb/gitweb.cgi +2 −7
diff --git a/gitweb/gitweb.cgi b/gitweb/gitweb.cgi
index 035e76d..2705a93 100755
--- a/gitweb/gitweb.cgi
+++ b/gitweb/gitweb.cgi
@@ -2295,16 +2295,12 @@ sub git_history {
 	      "</div>\n";
 	print "<div class=\"page_path\"><b>/" . esc_html($file_name) . "</b><br/></div>\n";
 
-	open my $fd, "-|", "$gitbin/git-rev-list $hash | $gitbin/git-diff-tree -r --stdin --
\'$file_name\'";
-	my $commit;
+	open my $fd, "-|", "$gitbin/git-rev-list $hash -- \'$file_name\'";
 	print "<table cellspacing=\"0\">\n";
 	my $alternate = 0;
 	while (my $line = <$fd>) {
 		if ($line =~ m/^([0-9a-fA-F]{40})/){
-			$commit = $1;
-			next;
-		}
-		if ($line =~ m/^:([0-7]{6}) ([0-7]{6}) ([0-9a-fA-F]{40}) ([0-9a-fA-F]{40}) (.)\t(.*)$/ &&
(defined $commit)) {
+			my $commit = $1;
 			my %co = git_read_commit($commit);
 			if (!%co) {
 				next;
@@ -2336,7 +2332,6 @@ sub git_history {
 			}
 			print "</td>\n" .
 			      "</tr>\n";
-			undef $commit;
 		}
 	}
 	print "</table>\n";
-- 
1.4.1.rc2.g4ce4
Junio C Hamano· Jul 1, 2006, 01:04 UTC · re: Luben Tuikov · lore

Re: [PATCH] Speed up history generation

Luben Tuikov <ltuikov@yahoo.com> writes:
Show 9 quoted lines
> Speed up history generation as suggested by Linus.
> @@ -2295,16 +2295,12 @@ sub git_history {
>  	      "</div>\n";
>  	print "<div class=\"page_path\"><b>/" . esc_html($file_name) . "</b><br/></div>\n";
>  
> -	open my $fd, "-|", "$gitbin/git-rev-list $hash | $gitbin/git-diff-tree -r --stdin --
> \'$file_name\'";
> -	my $commit;
> +	open my $fd, "-|", "$gitbin/git-rev-list $hash -- \'$file_name\'";

This would speed things up but at the same time it changes the semantics because it involves merge simplification, no?

At least that should be noted in the commit log.
Luben Tuikov· Jul 1, 2006, 01:11 UTC · re: Junio C Hamano · lore

Re: [PATCH] Speed up history generation

--- Junio C Hamano <junkio@cox.net> wrote:
Show 16 quoted lines
> Luben Tuikov <ltuikov@yahoo.com> writes:
> 
> > Speed up history generation as suggested by Linus.
> > @@ -2295,16 +2295,12 @@ sub git_history {
> >  	      "</div>\n";
> >  	print "<div class=\"page_path\"><b>/" . esc_html($file_name) . "</b><br/></div>\n";
> >  
> > -	open my $fd, "-|", "$gitbin/git-rev-list $hash | $gitbin/git-diff-tree -r --stdin --
> > \'$file_name\'";
> > -	my $commit;
> > +	open my $fd, "-|", "$gitbin/git-rev-list $hash -- \'$file_name\'";
> 
> This would speed things up but at the same time it changes the
> semantics because it involves merge simplification, no?
> 
> At least that should be noted in the commit log.

Ok, I guess this should be in the log. Can you add it please when commiting to the master git branch?

   Luben
Junio C Hamano· Jul 1, 2006, 01:20 UTC · re: Luben Tuikov · lore

Re: [PATCH] Speed up history generation

Luben Tuikov <ltuikov@yahoo.com> writes:
Show 18 quoted lines
> --- Junio C Hamano <junkio@cox.net> wrote:
>...
>> > @@ -2295,16 +2295,12 @@ sub git_history {
>> >  	      "</div>\n";
>> >  	print "<div class=\"page_path\"><b>/" . esc_html($file_name) . "</b><br/></div>\n";
>> >  
>> > -	open my $fd, "-|", "$gitbin/git-rev-list $hash | $gitbin/git-diff-tree -r --stdin --
>> > \'$file_name\'";
>> > -	my $commit;
>> > +	open my $fd, "-|", "$gitbin/git-rev-list $hash -- \'$file_name\'";
>> 
>> This would speed things up but at the same time it changes the
>> semantics because it involves merge simplification, no?
>> 
>> At least that should be noted in the commit log.
>
> Ok, I guess this should be in the log.  Can you add it please when
> commiting to the master git branch?

Well, by "at least", what I meant was that it might make sense to pass "--full-history" option to be more compatible with the original output. For graphical output like gitk, --full-history makes a mess on the screen, but a list-oriented output like gitweb it might be less confusing to show all the alternate paths that touched the path than leaving some histories out.

Luben Tuikov· Jul 1, 2006, 01:52 UTC · re: Junio C Hamano · lore

Re: [PATCH] Speed up history generation

--- Junio C Hamano <junkio@cox.net> wrote:
Show 27 quoted lines
> Luben Tuikov <ltuikov@yahoo.com> writes:
> 
> > --- Junio C Hamano <junkio@cox.net> wrote:
> >...
> >> > @@ -2295,16 +2295,12 @@ sub git_history {
> >> >  	      "</div>\n";
> >> >  	print "<div class=\"page_path\"><b>/" . esc_html($file_name) . "</b><br/></div>\n";
> >> >  
> >> > -	open my $fd, "-|", "$gitbin/git-rev-list $hash | $gitbin/git-diff-tree -r --stdin --
> >> > \'$file_name\'";
> >> > -	my $commit;
> >> > +	open my $fd, "-|", "$gitbin/git-rev-list $hash -- \'$file_name\'";
> >> 
> >> This would speed things up but at the same time it changes the
> >> semantics because it involves merge simplification, no?
> >> 
> >> At least that should be noted in the commit log.
> >
> > Ok, I guess this should be in the log.  Can you add it please when
> > commiting to the master git branch?
> 
> Well, by "at least", what I meant was that it might make sense
> to pass "--full-history" option to be more compatible with the
> original output.  For graphical output like gitk, --full-history
> makes a mess on the screen, but a list-oriented output like
> gitweb it might be less confusing to show all the alternate
> paths that touched the path than leaving some histories out.
Ok, I can add the --full-history option, test it out and resubmit.
    Luben
Linus Torvalds· Jul 1, 2006, 01:20 UTC · re: Junio C Hamano · lore

Re: [PATCH] Speed up history generation

On Fri, 30 Jun 2006, Junio C Hamano wrote:
Show 14 quoted lines
> Luben Tuikov <ltuikov@yahoo.com> writes:
> 
> > Speed up history generation as suggested by Linus.
> > @@ -2295,16 +2295,12 @@ sub git_history {
> >  	      "</div>\n";
> >  	print "<div class=\"page_path\"><b>/" . esc_html($file_name) . "</b><br/></div>\n";
> >  
> > -	open my $fd, "-|", "$gitbin/git-rev-list $hash | $gitbin/git-diff-tree -r --stdin --
> > \'$file_name\'";
> > -	my $commit;
> > +	open my $fd, "-|", "$gitbin/git-rev-list $hash -- \'$file_name\'";
> 
> This would speed things up but at the same time it changes the
> semantics because it involves merge simplification, no?

Or just add a flag or config option that enables "--full-history" on that git-rev-list. Perhaps it should be the default fir gitweb.

With --full-history, it should still be better to do this inside git-rev-list than piping things into git-diff-tree just to limit by pathname..

		Linus

← back to recent threads