| 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
| |||||||||||
| 21 | 0 | ▶ | my $count = $options->{fastmode} ? 1 : 3; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 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
| |||||||||||
| 48 | 0 | ▶ | warn $@ if $options->{verbose}; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 49 | 0 | $results = { failed => $@ }; | |||||||||
| 50 | } | ||||||||||
| 51 | |||||||||||
| 52 | 0 | return $results; | |||||||||
| 53 | } | ||||||||||
| 54 | |||||||||||
| 55 | 1 | 1; | |||||||||
| 56 | |||||||||||
| 57 | __END__ | ||||||||||