Re: [PATCH] gitweb: speed up project listing on large work trees by limiting find depth

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Luke Lu <git@xxxxxxxxxx> 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.
-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux