Skip to content

Instantly share code, notes, and snippets.

@wchristian
Created March 20, 2012 16:37
Show Gist options
  • Save wchristian/2138007 to your computer and use it in GitHub Desktop.
Save wchristian/2138007 to your computer and use it in GitHub Desktop.
use strictures;
package moose_perf;
use 5.010;
use Git::PurePerl::Object::Tree;
use Git::PurePerl::DirectoryEntry;
use Time::HiRes 'time';
run();
exit;
sub run {
my $git = bless {}, "Git::PurePerl";
my @trees;
say "preparing";
for my $i ( 0 .. 20 ) {
my $tree = Git::PurePerl::Object::Tree->new(
content => "",
git => $git,
sha1 => "",
size => 0,
);
my @entries = map Git::PurePerl::DirectoryEntry->new( filename => $_, git => $git, mode => 0, sha1 => "" ),
0 .. 1600;
$tree->directory_entries( \@entries );
push @trees, $tree;
}
say "destroying";
while ( @trees ) {
my $thing = pop @trees;
my $start = time;
undef $thing;
my $end = time;
say sprintf "%04d %.3f", scalar @trees, ( $end - $start );
}
return;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment