Skip to content

Commit

Permalink
Item10316: More meaningful benchmark report
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.foswiki.org/trunk@11596 0b4bb1d4-4e5a-0410-9cc4-b2b747904278
  • Loading branch information
PaulHarvey authored and PaulHarvey committed May 1, 2011
1 parent 383b0de commit 4b7f052
Showing 1 changed file with 11 additions and 13 deletions.
24 changes: 11 additions & 13 deletions UnitTestContrib/test/unit/Fn_SECTION.pm
Original file line number Diff line number Diff line change
Expand Up @@ -248,22 +248,20 @@ sub test_manysections_timing {
my ($this) = @_;
my %sections = $this->_manysections_setup();
my $numsections = scalar( keys %sections );
my $start = Benchmark->new();
my $end;
my $cycles = 50;

foreach ( 1 .. $cycles ) {
foreach my $section ( keys %sections ) {
Foswiki::Func::expandCommonVariables(<<"HERE");
my $numcycles = 50;
my $benchmark = timeit(
$numcycles,
sub {
foreach my $section ( keys %sections ) {
Foswiki::Func::expandCommonVariables(<<"HERE");
%INCLUDE{"$this->{test_web}.$this->{test_topic}" section="$section"}%
HERE
}
}
}
$end = Benchmark->new();
print "Time for $cycles cycles of $numsections sections ("
. $numsections * $cycles
. " INCLUDEs) was:\n"
. timestr( timediff( $end, $start ) ) . "\n";
);

print "Timing for $numcycles cycles of $numsections sections: "
. timestr($benchmark) . "\n";

return;
}
Expand Down

0 comments on commit 4b7f052

Please sign in to comment.