I mentioned a week or two ago that we are unable to upgrade to darcs2 because it is slower than darcs1.
I did some benchmarking, and find that darcs1 is much faster than darcs2. I also found that non-debian versions of darcs2 are quite a bit faster than debian versions of darcs2. Attached to this e-mail message are the perl script I used to run my benchmarking and the shell scripts I used to invoke gnuplot. perl darcs_benchmark.pl $source_repo $target_dir $darcsexecutable sh plot_darcs_time.sh $datafile1 $datafile2 ... sh plot_darcs_cpu.sh $datafile1 $datafile2 ... The benchmarking is very simple, and just gives a rough picture of the speed of darcs doing common things on a repo. I used four versions of darcs on the same type-1 repo, and collected stats on all of them. I also made a type-2 repo from the type-1 repo and used three versions of darcs2 to collect stats on those. darcs109 - non-debian darcs 1.0.9 (release) darcs202 - debian darcs 2.0.2 (release) darcs210 - non-debian darcs 2.1.0 (release) darcs211 - debian darcs 2.1.1rc2 (+ 281 patches) My next two messages will have the stats I collected and SVG images created by gnuplot (don't seem to work in my inkscape, but work fine using ImageMagick's display). I used /usr/bin/time to do the timing, so the perl script will probably not work under MS Windows. -kolibrie
#!/usr/bin/perl
use File::Path qw(rmtree);
use File::Temp;
my $source_repo = shift(@ARGV) || '.';
my $target_repo = shift(@ARGV) || '/tmp/darcs_benchmark';
my $darcs = shift(@ARGV) || 'darcs';
my $time = '/usr/bin/time';
my $fh = File::Temp->new();
my $bundle_file = $fh->filename;
(my $add_file = $bundle_file) =~ s/^.*\///;
my $patch_hash; # will be populated later
my @commands = (
qq{$darcs get $source_repo $target_repo},
qq{$darcs obliterate --repodir $target_repo --last 3 --all},
qq{$darcs push --repodir $source_repo $target_repo --all},
qq{$darcs obliterate --repodir $target_repo --last 3 --all},
qq{$darcs pull --repodir $target_repo $source_repo --all},
qq{$darcs obliterate --repodir $target_repo --last 3 --all},
qq{$darcs send --repodir $source_repo $target_repo --all -o $bundle_file},
qq{$darcs apply --repodir $target_repo --all $bundle_file},
qq{$darcs changes --repodir $target_repo --last 1 --xml},
qq{$darcs annotate --repodir $target_repo --match 'hash \$patch_hash'},
qq{$darcs diff -u --repodir $target_repo --match 'hash \$patch_hash'},
qq{$darcs whatsnew --repodir $target_repo -s},
qq{cp $bundle_file $target_repo/},
qq{$darcs add --repodir $target_repo $add_file},
qq{$darcs whatsnew --repodir $target_repo -s},
qq{$darcs record --repodir $target_repo --all --author $0 -m 'added file $add_file'},
qq{echo 'new line in file' >> $target_repo/$add_file},
qq{$darcs whatsnew --repodir $target_repo -s},
qq{$darcs revert --repodir $target_repo --all},
qq{$darcs check --repodir $target_repo},
);
remove_directory($target_repo);
my @columns = qw(real user sys command);
print "# " . join(' ', @columns) . "\n";
foreach my $command (@commands) {
$command =~ s/\$patch_hash\b/$patch_hash/g;
my ($time, $output) = time_command($command);
if ($command =~ /^$darcs/) {
# we are only interested in benchmarking stats for darcs
print join(' ', map { $time->{$_} } @columns) . "\n";
}
if ($$output =~ /hash='(.+?)'/) {
# so we can run commands against the patch matching this hash
$patch_hash = $1;
}
}
sub time_command {
my $command = shift;
my %time = ();
my $fh = File::Temp->new();
my $time_file = $fh->filename;
my $output = `$time -f 'real %E,user %U,sys %S,command %C' -o $time_file $command`;
while (my $line = $fh->getline) {
my @parts = split(/,/, $line);
foreach my $part (@parts) {
if ($part =~ /(\w+)\s+(.+)/) {
$time{$1} = $2;
}
}
}
return (\%time, \$output);
}
sub remove_directory {
my $target_repo = shift;
if (-d $target_repo) {
my @files = directory_files($target_repo);
if (@files) {
print "Looks like $target_repo already exists\n";
print "(and contains " . scalar(@files) . " items)\n";
print "Shall I delete all files and continue? [y/N]: ";
my $response = <STDIN>;
chomp $response;
if ($response eq 'y') {
rmtree($target_repo);
}
if (-d $target_repo) {
die "aborting: failed to remove $target_repo\n";
}
}
}
}
sub directory_files {
my $directory = shift;
my @files = ();
if (opendir DIR, $directory) {
push @files, grep { $_ ne '.' and $_ ne '..' } readdir DIR;
} else {
die "failed to read directory $directory: $!\n";
}
return @files;
}
plot_darcs_time.sh
Description: Bourne shell script
plot_darcs_cpu.sh
Description: Bourne shell script
signature.asc
Description: Digital signature
_______________________________________________ darcs-users mailing list [email protected] http://lists.osuosl.org/mailman/listinfo/darcs-users
