From: Jakub Narebski <jnareb@gmail.com>
To: git@vger.kernel.org
Subject: Re: [PATCH 2/2 (take 2)] gitweb: Make git_get_refs_list do work of git_get_references
Date: Sun, 17 Sep 2006 12:00:41 +0200 [thread overview]
Message-ID: <200609171158.48358.jnareb@gmail.com> (raw)
In-Reply-To: <7vfyeq6dn3.fsf@assigned-by-dhcp.cox.net>
Junio C Hamano wrote:
> Jakub Narebski <jnareb@gmail.com> writes:
>
> > This was supposed to make gitweb performance better, by
> > (in the case of git_summary) replacing three calls to git-peek-remote
> > (or one reading info/refs and two calls to git-peek-remote) by only
> > one such a call. ApacheBench shows that after changes summary and tags
> > views are slower, while heads remains the same or even faster (?).
>
> That does not give us much confidence in the patch, does it? If
> it results in cleaner code that is fine, though.
This was because the additional test you proposed for "it is tag if
it is followed by deref" was implemented incorrectly. Corrected in "take 3"
of this patch.
> > @@ -1107,8 +1115,8 @@ sub git_get_refs_list {
> > push @reflist, \%ref_item;
> > }
> > # sort refs by age
> > - @reflist = sort {$b->{'epoch'} <=> $a->{'epoch'}} @reflist;
> > - return \@reflist;
> > + #@reflist = sort {$b->{'epoch'} <=> $a->{'epoch'}} @reflist;
> > + return (\@reflist, \%refs);
> > }
>
> I've already said I do not like commented out lines that do not
> say why they are commented out, but I sense something more
> serious here. Doesn't this removal of sorting affect the
> callers?
Corrected in "take 3" of this patch.
> > @@ -2072,14 +2080,14 @@ sub git_tags_body {
> >
> > sub git_heads_body {
> > # uses global variable $project
> > - my ($taglist, $head, $from, $to, $extra) = @_;
> > + my ($headlist, $head, $from, $to, $extra) = @_;
> > $from = 0 unless defined $from;
> > - $to = $#{$taglist} if (!defined $to || $#{$taglist} < $to);
> > + $to = $#{$headlist} if (!defined $to || $#{$headlist} < $to);
> >
> > print "<table class=\"heads\" cellspacing=\"0\">\n";
> > my $alternate = 0;
> > for (my $i = $from; $i <= $to; $i++) {
> > - my $entry = $taglist->[$i];
> > + my $entry = $headlist->[$i];
> > my %tag = %$entry;
> > my $curr = $tag{'id'} eq $head;
> > if ($alternate) {
>
> Unrelated but indeed is a good clean-up. It was quite confusing
> before (I think this was a result of cut and paste reuse).
And I see that this cleanup is incomplete (%tag = %$entry). Gaah.
Should I split cleanup patch?
> > @@ -2500,7 +2518,7 @@ sub git_tags {
> > git_print_page_nav('','', $head,undef,$head);
> > git_print_header_div('summary', $project);
> >
> > - my $taglist = git_get_refs_list("refs/tags");
> > + my ($taglist) = git_get_refs_list("tags");
> > if (defined @$taglist) {
> > git_tags_body($taglist);
> > }
> > @@ -2513,9 +2531,9 @@ sub git_heads {
> > git_print_page_nav('','', $head,undef,$head);
> > git_print_header_div('summary', $project);
> >
> > - my $taglist = git_get_refs_list("refs/heads");
> > - if (defined @$taglist) {
> > - git_heads_body($taglist, $head);
> > + my ($headlist) = git_get_refs_list("heads");
> > + if (defined @$headlist) {
> > + git_heads_body($headlist, $head);
> > }
> > git_footer_html();
> > }
>
> It always confuses me when people say:
>
> if (defined @$arrayref)
Gaah. It should be either
if (defined $arrayref)
or
if (@$arrayref)
or (if one is truly paranoid) ;-)
if (defined $arrayref && ref($arrayref) eq "ARRAY" && @$arrayref)
[...]
> You probably would want to grep for 'defined @' and fix them all
> at once.
Will do. Unless someone will do this first.
--
Jakub Narebski
Poland
next prev parent reply other threads:[~2006-09-17 10:00 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-09-17 0:26 [PATCH] gitweb: Make git_get_refs_list do work of git_get_references Jakub Narebski
2006-09-17 0:37 ` [PATCH 1/2] gitweb: Always use git-peek-remote in git_get_references Jakub Narebski
2006-09-17 1:22 ` [PATCH] gitweb: Make git_get_refs_list do work of git_get_references Junio C Hamano
2006-09-17 1:40 ` Randal L. Schwartz
2006-09-17 2:12 ` Junio C Hamano
2006-09-17 2:17 ` Randal L. Schwartz
2006-09-17 2:29 ` Junio C Hamano
[not found] ` <200609171057.56467.jnareb@gmail.com>
[not found] ` <7vfyeq6dn3.fsf@assigned-by-dhcp.cox.net>
2006-09-17 10:00 ` Jakub Narebski [this message]
2006-09-17 10:02 ` [PATCH 2/2 (take 2)] " Jakub Narebski
2006-09-17 10:06 ` Jakub Narebski
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=200609171158.48358.jnareb@gmail.com \
--to=jnareb@gmail.com \
--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.
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 NNTP newsgroup(s).