PerlStone2015/09data.pm

filter: Statementstmt 33.3% 13 / 39 Branchbran 0.0% 0 / 14 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 37.5% 3 / 8 Podpod 0.0% 0 / 3 totaltotal 25.0% 16 / 64 CC 8 SCAR 23.6
CC
8
Cov
25%
a_copy
20.0
a_alloc
12.0
main
12.0
CRAP 10.6
« PerlStone2015/mandelbrot.pm ↑ Summary PerlStone2015/fannkuch.pm »
1 package Benchmark::Perl::Formance::Plugin::PerlStone2015::09data;
2 1 our $AUTHORITY = 'cpan:SCHWIGON';
3 # ABSTRACT: benchmark - perl 09 - data
4 1 $Benchmark::Perl::Formance::Plugin::PerlStone2015::09data::VERSION = '0.002';
5 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 #############################################################
9 # #
10 # Benchmark Code ahead - Don't touch without strong reason! #
11 # #
12 #############################################################
13  
14 1 ▶use Benchmark ':hireswallclock';
Subroutine BEGIN: called CC=1 SCAR=0.0
15  
16 1 my @stuff;
17  
18 sub a_alloc
19 0 ▶{
Subroutine a_alloc: not called CC=3 SCAR=24.8
Pod undocumented
20 0 my ($options) = @_;
21  
22 0 ▶ my $goal = $options->{fastmode} ? 10_000_000 : 20_000_000;
Branch: 1 branch
BranchTrueFalseTotal
$options->{'fastmode'} ? : 0 0 0
23 0 ▶ my $count = $options->{fastmode} ? 154 : 950;
Branch: 1 branch
BranchTrueFalseTotal
$options->{'fastmode'} ? : 0 0 0
24  
25 0 ▶ my $t = timeit $count, sub {
Subroutine __ANON__: not called CC=1 SCAR=6.9
26 0 my @stuff1;
27 0 $#stuff1 = $goal;
28 0 };
29 return {
30 0 Benchmark => $t,
31 goal => $goal,
32 count => $count,
33 };
34 }
35  
36 sub a_copy
37 0 ▶{
Subroutine a_copy: not called CC=4 SCAR=30.0
Pod undocumented
38 0 my ($options) = @_;
39  
40 0 ▶ my $goal = $options->{fastmode} ? 10_000_000 : 20_000_000;
Branch: 1 branch
BranchTrueFalseTotal
$options->{'fastmode'} ? : 0 0 0
41 0 ▶ my $count = $options->{fastmode} ? 6 : 38;
Branch: 1 branch
BranchTrueFalseTotal
$options->{'fastmode'} ? : 0 0 0
42 0 my $size = 0;
43  
44 0 my @stuff;
45 0 $#stuff = $goal;
46  
47 0 eval qq{use Devel::Size 'total_size'};
48 0 ▶ $size = total_size(\@stuff) if !$@;
Branch: 1 branch
BranchTrueFalseTotal
unless $@ 0 0 0
49  
50 0 ▶ my $t = timeit $count, sub {
Subroutine __ANON__: not called CC=1 SCAR=6.9
51 0 my @copy = @stuff;
52 0 };
53 return {
54 0 Benchmark => $t,
55 goal => $goal,
56 count => $count,
57 total_size_bytes => $size,
58 };
59 }
60  
61 sub main
62 0 ▶{
Subroutine main: not called CC=3 SCAR=24.8
Pod undocumented
63 0 my ($options) = @_;
64  
65 0 my $results;
66 0 eval {
67 0 $results = {
68 a_alloc => a_alloc($options),
69 a_copy => a_copy ($options),
70 };
71 };
72  
73 0 ▶ if ($@) {
Branch: 1 branch
BranchTrueFalseTotal
if ($@) 0 0 0
74 0 ▶ warn $@ if $options->{verbose};
Branch: 1 branch
BranchTrueFalseTotal
if $options->{"verbose"} 0 0 0
75 0 $results = { failed => $@ };
76 }
77  
78 0 return $results;
79 }
80  
81 1 1;
82  
83 __END__
« PerlStone2015/mandelbrot.pm ↑ Summary PerlStone2015/fannkuch.pm »