* [PATCH] Speed up project listing for large working trees by limiting find depth
@ 2007-10-16 22:37 Luke Lu
0 siblings, 0 replies; 2+ messages in thread
From: Luke Lu @ 2007-10-16 22:37 UTC (permalink / raw)
To: git; +Cc: gitster, Luke Lu
Simple gitweb patch to speed up project listing on checked out repos
with large trees. It was spending minutes in perl (5.8.8 macports).
It's taking a fraction of a second after the patch. Resubmitted per
Andreas Ericsson's advice.
---
gitweb/gitweb.perl | 4 ++++
1 files changed, 4 insertions(+), 0 deletions(-)
diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index 3064298..a30eef9 100755
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
@@ -1509,16 +1509,20 @@ sub git_get_projects_list {
# remove the trailing "/"
$dir =~ s!/+$!!;
my $pfxlen = length("$dir");
+ my $pfxdepth = ($dir =~ tr!/!!);
File::Find::find({
follow_fast => 1, # follow symbolic links
follow_skip => 2, # ignore duplicates
+ no_chdir => 1, # don't chdir into every directory
dangling_symlinks => 0, # ignore dangling symlinks, silently
wanted => sub {
# skip project-list toplevel, if we get it.
return if (m!^[/.]$!);
# only directories can be git repositories
return unless (-d $_);
+ # don't traverse too deep (Find is super slow on os x)
+ return if tr!/!! - $pfxdepth > 2 && ($File::Find::prune = 1);
my $subdir = substr($File::Find::name, $pfxlen + 1);
# we check related file in $projectroot
--
1.5.3.4
^ permalink raw reply related [flat|nested] 2+ messages in thread
* [PATCH] Speed up project listing for large working trees by limiting find depth
@ 2007-10-16 23:02 Luke Lu
0 siblings, 0 replies; 2+ messages in thread
From: Luke Lu @ 2007-10-16 23:02 UTC (permalink / raw)
To: git; +Cc: gitster, Luke Lu
Forgot -s last time when resubmitting the patch.
Here is a simple gitweb patch to speed up project listing on checked
out repos with large trees. It was spending minutes in perl (5.8.8
macports). Reduced to a fraction of a second after the patch.
Signed-off-by: Luke Lu <git@vicaya.com>
---
gitweb/gitweb.perl | 4 ++++
1 files changed, 4 insertions(+), 0 deletions(-)
diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index 3064298..a30eef9 100755
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
@@ -1509,16 +1509,20 @@ sub git_get_projects_list {
# remove the trailing "/"
$dir =~ s!/+$!!;
my $pfxlen = length("$dir");
+ my $pfxdepth = ($dir =~ tr!/!!);
File::Find::find({
follow_fast => 1, # follow symbolic links
follow_skip => 2, # ignore duplicates
+ no_chdir => 1, # don't chdir into every directory
dangling_symlinks => 0, # ignore dangling symlinks, silently
wanted => sub {
# skip project-list toplevel, if we get it.
return if (m!^[/.]$!);
# only directories can be git repositories
return unless (-d $_);
+ # don't traverse too deep (Find is super slow on os x)
+ return if tr!/!! - $pfxdepth > 2 && ($File::Find::prune = 1);
my $subdir = substr($File::Find::name, $pfxlen + 1);
# we check related file in $projectroot
--
1.5.3.4
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2007-10-16 23:02 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-10-16 22:37 [PATCH] Speed up project listing for large working trees by limiting find depth Luke Lu
-- strict thread matches above, loose matches on Subject: below --
2007-10-16 23:02 Luke Lu
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).