Benchmark-Perl-Formance-Plugin-PerlStone2015

 view release on metacpan or  search on metacpan

lib/Benchmark/Perl/Formance/Plugin/PerlStone2015/binarytrees.pm  view on Meta::CPAN

                my $stretch_depth = $max_depth + 1;
                my $stretch_tree = bottom_up_tree($stretch_depth);
                # print "stretch tree of depth $stretch_depth\t check: ",
                #     item_check($stretch_tree), "\n";
        }

        my $long_lived_tree = bottom_up_tree($max_depth);

        my $depth = $min_depth;
        while ( $depth <= $max_depth ) {
                my $iterations = 2 ** ($max_depth - $depth + $min_depth);
                my $check = 0;

                foreach my $i (1..$iterations) {
                        my $temp_tree = bottom_up_tree($depth);
                        $check += item_check($temp_tree);

                        $temp_tree = bottom_up_tree($depth);
                        $check += item_check($temp_tree);
                }

                #print $iterations * 2, "\t trees of depth $depth\t check: ", $check, "\n";
                $depth += 2;
        }

        # print "long lived tree of depth $max_depth\t check: ",
        #     item_check($long_lived_tree), "\n";
}

sub main
{
        my ($options) = @_;



( run in 1.444 second using v1.01-cache-2.11-cpan-96521ef73a4 )