From: Robert Fitzsimons <robfitz@273k.net>
To: git@vger.kernel.org
Subject: [PATCH] Small optimizations to gitweb
Date: Mon, 18 Dec 2006 22:43:27 +0000 [thread overview]
Message-ID: <20061218224327.GG16029@localhost> (raw)
Limit some of the git_cmd's so they only return the number of lines
that will be processed. Don't recompute head hash or have_snapshot
values.
Signed-off-by: Robert Fitzsimons <robfitz@273k.net>
---
gitweb/gitweb.perl | 9 ++++++---
1 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index 5ea3fda..1990f15 100755
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
@@ -1141,6 +1141,7 @@ sub git_get_last_activity {
open($fd, "-|", git_cmd(), 'for-each-ref',
'--format=%(refname) %(committer)',
'--sort=-committerdate',
+ '--count=1',
'refs/heads') or return;
my $most_recent = <$fd>;
close $fd or return;
@@ -2559,6 +2560,8 @@ sub git_shortlog_body {
# uses global variable $project
my ($revlist, $from, $to, $refs, $extra) = @_;
+ my $have_snapshot = gitweb_have_snapshot();
+
$from = 0 unless defined $from;
$to = $#{$revlist} if (!defined $to || $#{$revlist} < $to);
@@ -2586,7 +2589,7 @@ sub git_shortlog_body {
$cgi->a({-href => href(action=>"commit", hash=>$commit)}, "commit") . " | " .
$cgi->a({-href => href(action=>"commitdiff", hash=>$commit)}, "commitdiff") . " | " .
$cgi->a({-href => href(action=>"tree", hash=>$commit, hash_base=>$commit)}, "tree");
- if (gitweb_have_snapshot()) {
+ if ($have_snapshot) {
print " | " . $cgi->a({-href => href(action=>"snapshot", hash=>$commit)}, "snapshot");
}
print "</td>\n" .
@@ -2876,8 +2879,8 @@ sub git_summary {
}
}
- open my $fd, "-|", git_cmd(), "rev-list", "--max-count=17",
- git_get_head_hash($project), "--"
+ open my $fd, "-|", git_cmd(), "rev-list", "--max-count=16",
+ $head, "--"
or die_error(undef, "Open git-rev-list failed");
my @revlist = map { chomp; $_ } <$fd>;
close $fd;
--
1.4.4.2.gee60-dirty
next prev reply other threads:[~2006-12-18 23:05 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-12-22 19:38 [PATCH 1/4] gitweb: Add missing show '...' links change Robert Fitzsimons
2006-12-18 22:43 ` Robert Fitzsimons [this message]
2006-12-18 23:17 ` [PATCH] Small optimizations to gitweb Jakub Narebski
2006-12-18 23:45 ` Junio C Hamano
2006-12-19 0:59 ` Jakub Narebski
2006-12-19 5:48 ` Junio C Hamano
2006-12-19 11:14 ` [PATCH] gitweb: Show '...' links in "summary" view only if there are more items Jakub Narebski
2006-12-19 12:08 ` Robert Fitzsimons
2006-12-19 12:28 ` Jakub Narebski
2006-12-19 12:41 ` Robert Fitzsimons
2006-12-19 12:42 ` Jakub Narebski
2006-12-19 18:05 ` Junio C Hamano
[not found] ` <8edd09bf9114df40281e7527df8704b1a94bb280.1166813858.git.robfitz@273k.net>
2006-12-22 19:38 ` [PATCH 1/4] gitweb: Add missing show '...' links change Robert Fitzsimons
2006-12-22 19:38 ` [PATCH 2/4] gitweb: optimize git_get_last_activity Robert Fitzsimons
2006-12-22 19:38 ` [PATCH 3/4] gitweb: optimize git_shortlog_body Robert Fitzsimons
2006-12-22 19:38 ` [PATCH 4/4] gitweb: optimize git_summary Robert Fitzsimons
2006-12-22 20:07 ` [PATCH 2/4] gitweb: optimize git_get_last_activity Jakub Narebski
2006-12-22 20:09 ` [PATCH 1/4] gitweb: Add missing show '...' links change Jakub Narebski
2006-12-22 21:52 ` Junio C Hamano
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20061218224327.GG16029@localhost \
--to=robfitz@273k.net \
--cc=git@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).