All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Shawn O. Pearce" <spearce@spearce.org>
To: Luke Lu <git@vicaya.com>
Cc: git@vger.kernel.org, pasky@suse.cz
Subject: Re: [PATCH] gitweb: speed up project listing on large work trees by limiting find depth
Date: Wed, 17 Oct 2007 00:27:24 -0400	[thread overview]
Message-ID: <20071017042724.GU13801@spearce.org> (raw)
In-Reply-To: <6B74E96C-37ED-4D6A-8A98-C90B61EFA181@vicaya.com>

Luke Lu <git@vicaya.com> wrote:
> On Oct 16, 2007, at 9:00 PM, Shawn O. Pearce wrote:
> >
> >Thanks.  I'm squashing this into your patch.  I'm not sure what
> >the impact is of altering $File::Find::name in the middle of the
> >find algorithm and I'm not sure we want to figure that out later.
> >We found out the hard way today that altering a non-local'd $_
> >in the function is what was causing the breakage.
> 
> This is generally a good advice. But tr!/!! doesn't alter the string  
> at all (OK, replicates it), unless you use the /d option. tr/stuff//  
> is an idiom to count stuff. Check perldoc perlop for details. I don't  
> think it's necessary.

Oh.  Yea, I see what you mean now.  So the bug was really that you
were matching on $_ not $File::Find::name.  But according to perldoc
File::Find $_ and $File::Find::name are the same when no_chdir =>
1 which your patch also sets.  So I'm really not seeing how the
updated version fixes the bug.
 
> >diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
> >index 48e21da..9f47c3f 100755
> >--- a/gitweb/gitweb.perl
> >+++ b/gitweb/gitweb.perl
> >@@ -1525,7 +1525,8 @@ sub git_get_projects_list {
> > 				# only directories can be git repositories
> > 				return unless (-d $_);
> > 				# don't traverse too deep (Find is super 
> > 				slow on os x)
> >-				if (($File::Find::name =~ tr!/!!) - 
> >$pfxdepth >  $project_maxdepth) {
> >+				local $_ = $File::Find::name;
> >+				if (tr!/!! - $pfxdepth > $project_maxdepth) {
> > 					$File::Find::prune = 1;
> > 					return;
> > 				}

-- 
Shawn.

  reply	other threads:[~2007-10-17  4:27 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-10-17  3:45 [PATCH] gitweb: speed up project listing on large work trees by limiting find depth Luke Lu
2007-10-17  4:00 ` Shawn O. Pearce
2007-10-17  4:19   ` Luke Lu
2007-10-17  4:27     ` Shawn O. Pearce [this message]
     [not found]       ` <562B5254-2BE7-43DF-AB62-499458E360CC@vicaya.com>
2007-10-17  5:25         ` Shawn O. Pearce

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=20071017042724.GU13801@spearce.org \
    --to=spearce@spearce.org \
    --cc=git@vger.kernel.org \
    --cc=git@vicaya.com \
    --cc=pasky@suse.cz \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.