PerlStone2015/05regex.pm

filter: Statementstmt 42.8% 12 / 28 Branchbran 0.0% 0 / 8 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 50.0% 3 / 6 Podpod 0.0% 0 / 2 totaltotal 34.0% 15 / 44 CC 6 SCAR 20.7
CC
6
Cov
33%
fixedstr
12.0
main
12.0
__ANON__
6.0
CRAP 7.9
« PerlStone2015/07lists.pm ↑ Summary PerlStone2015/nbody.pm »
1 package Benchmark::Perl::Formance::Plugin::PerlStone2015::05regex;
2 1 our $AUTHORITY = 'cpan:SCHWIGON';
3 # ABSTRACT: benchmark - perl 05 - regex
4 1 $Benchmark::Perl::Formance::Plugin::PerlStone2015::05regex::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 sub fixedstr
17 0 ▶{
Subroutine fixedstr: not called CC=3 SCAR=24.8
Pod undocumented
18 0 my ($options) = @_;
19  
20 0 ▶ my $goal = $options->{fastmode} ? 300_000 : 1_000_000;
Branch: 1 branch
BranchTrueFalseTotal
$options->{'fastmode'} ? : 0 0 0
21 0 ▶ my $count = $options->{fastmode} ? 1 : 3;
Branch: 1 branch
BranchTrueFalseTotal
$options->{'fastmode'} ? : 0 0 0
22  
23 0 ▶ my $t = timeit $count, sub {
Subroutine __ANON__: not called CC=2 SCAR=17.9
24 0 my $s;
25 0 $s = "a" x 10_000 . "wxyz";
26 0 $s =~ /wxyz/ for 1..$goal;
27 0 };
28  
29 return {
30 0 Benchmark => $t,
31 goal => $goal,
32 count => $count,
33 };
34 }
35  
36 sub main
37 0 ▶{
Subroutine main: not called CC=3 SCAR=24.8
Pod undocumented
38 0 my ($options) = @_;
39  
40 0 my $results;
41 0 eval {
42 0 $results = {
43 fixedstr => fixedstr($options),
44 };
45 };
46  
47 0 ▶ if ($@) {
Branch: 1 branch
BranchTrueFalseTotal
if ($@) 0 0 0
48 0 ▶ warn $@ if $options->{verbose};
Branch: 1 branch
BranchTrueFalseTotal
if $options->{"verbose"} 0 0 0
49 0 $results = { failed => $@ };
50 }
51  
52 0 return $results;
53 }
54  
55 1 1;
56  
57 __END__
« PerlStone2015/07lists.pm ↑ Summary PerlStone2015/nbody.pm »