cvsserver: checkout faster by sending files in a sensible order
Just by sending the files in an ordered fashion, clients can process them much faster. And we can optimize our check of whether we created this directory already -- faster. Timings for a checkout on a commandline cvs client for a project with ~13K files totalling ~100MB: Unsorted: 603.12 real 16.89 user 42.88 sys Sorted: 298.19 real 26.37 user 42.42 sys
Martin Langhoff committed
Mar 3, 2006 at 16:38 UTC
501c7372c73c980eed042c90e3518c2ab816c846
1 file changed
+5
-2
git-cvsserver.perl
+5
-2
@@ -584,6 +584,7 @@ sub req_co
584
print "E cvs checkout: Updating $checkout_path\n";
585
586
my %seendirs = ();
587
+ my $lastdir ='';
588
589
foreach my $git ( @{$updater->gethead} )
590
{
@@ -603,7 +604,8 @@ sub req_co
604
print "M U $checkout_path/$git->{name}\n";
605
}
606
606
- if (length($git->{dir}) && $git->{dir} ne './' && !exists($seendirs{$git->{dir}})) {
607
+ if (length($git->{dir}) && $git->{dir} ne './'
608
+ && $git->{dir} ne $lastdir && !exists($seendirs{$git->{dir}})) {
609
610
# Eclipse seems to need the Clear-sticky command
611
# to prepare the 'Entries' file for the new directory.
@@ -612,6 +614,7 @@ sub req_co
614
print "Clear-static-directory $module/$git->{dir}\n";
615
print $state->{CVSROOT} . "/$module/$git->{dir}\n";
616
print "E cvs checkout: Updating /$module/$git->{dir}\n";
617
+ $lastdir = $git->{dir};
618
$seendirs{$git->{dir}} = 1;
619
}
620
@@ -2349,7 +2352,7 @@ sub gethead
2352
2353
return $self->{gethead_cache} if ( defined ( $self->{gethead_cache} ) );
2354
2352
- my $db_query = $self->{dbh}->prepare_cached("SELECT name, filehash, mode, revision, modified, commithash, author FROM head",{},1);
2355
+ my $db_query = $self->{dbh}->prepare_cached("SELECT name, filehash, mode, revision, modified, commithash, author FROM head ORDER BY name ASC",{},1);
2356
$db_query->execute();
2357
2358
my $tree = [];