« blib/lib/Benchmark/Perl/Formance.pm
↑ Summary
blib/lib/Benchmark/Perl/Formance/Plugin/Shootout/regexdna.pm »
| 1 | package Benchmark::Perl::Formance::Plugin::Shootout; | ||||||||||
| 2 | 1 | our $AUTHORITY = 'cpan:SCHWIGON'; | |||||||||
| 3 | # ABSTRACT: benchmark plugin - Shootout - Benchmark::Perl::Formance plugin covering Shootout code | ||||||||||
| 4 | |||||||||||
| 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 | 1 | ▶ | use Benchmark ':hireswallclock'; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 9 | 1 | ▶ | use Data::Dumper; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 10 | |||||||||||
| 11 | 1 | our $VERSION = "0.001"; | |||||||||
| 12 | |||||||||||
| 13 | ############################################################# | ||||||||||
| 14 | # # | ||||||||||
| 15 | # Benchmark Code ahead - Don't touch without strong reason! # | ||||||||||
| 16 | # # | ||||||||||
| 17 | ############################################################# | ||||||||||
| 18 | |||||||||||
| 19 | sub shootout | ||||||||||
| 20 | 0 | ▶ | { | ||||||||
|
Subroutine
shootout: not called CC=8 SCAR=40.1
Pod
undocumented
| |||||||||||
| 21 | 0 | my ($options) = @_; | |||||||||
| 22 | |||||||||||
| 23 | 1 | ▶ | no strict "refs"; ## no critic | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 24 | |||||||||||
| 25 | 0 | my $verbose = $options->{verbose}; | |||||||||
| 26 | 0 | my %results = (); | |||||||||
| 27 | #fannkuch | ||||||||||
| 28 | #knucleotide | ||||||||||
| 29 | #mandelbrot | ||||||||||
| 30 | 0 | for my $subtest (qw( binarytrees | |||||||||
| 31 | fasta | ||||||||||
| 32 | nbody | ||||||||||
| 33 | pidigits | ||||||||||
| 34 | regexdna | ||||||||||
| 35 | revcomp | ||||||||||
| 36 | spectralnorm | ||||||||||
| 37 | )) | ||||||||||
| 38 | { | ||||||||||
| 39 | 0 | ▶ | print STDERR "# - $subtest...\n" if $options->{verbose} > 2; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 40 | 0 | eval "use Benchmark::Perl::Formance::Plugin::Shootout::$subtest"; ## no critic | |||||||||
| 41 | 0 | ▶ | if ($@) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 42 | 0 | ▶ | print STDERR "# Skip Shootout plugin '$subtest'" if $verbose; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 43 | 0 | ▶ | print STDERR ":$@" if $verbose >= 2; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 44 | 0 | ▶ | print STDERR "\n" if $verbose; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 45 | } | ||||||||||
| 46 | else { | ||||||||||
| 47 | 0 | eval { | |||||||||
| 48 | 0 | my $main = __PACKAGE__."::$subtest"."::main"; | |||||||||
| 49 | 0 | $results{$subtest} = $main->($options); | |||||||||
| 50 | }; | ||||||||||
| 51 | 0 | ▶ | if ($@) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 52 | 0 | $results{$subtest} = { failed => $@ }; | |||||||||
| 53 | } | ||||||||||
| 54 | } | ||||||||||
| 55 | } | ||||||||||
| 56 | 0 | return \%results; | |||||||||
| 57 | } | ||||||||||
| 58 | |||||||||||
| 59 | sub main | ||||||||||
| 60 | 0 | ▶ | { | ||||||||
|
Subroutine
main: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||
| 61 | 0 | my ($options) = @_; | |||||||||
| 62 | |||||||||||
| 63 | 0 | return shootout($options); | |||||||||
| 64 | } | ||||||||||
| 65 | |||||||||||
| 66 | 1 | 1; # End of Benchmark::Perl::Formance::Plugin::Shootout | |||||||||
| 67 | |||||||||||
| 68 | __END__ | ||||||||||