| 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
| |||||||||||
| 23 | 0 | ▶ | my $count = $options->{fastmode} ? 154 : 950; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 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
| |||||||||||
| 41 | 0 | ▶ | my $count = $options->{fastmode} ? 6 : 38; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 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
| |||||||||||
| 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
| |||||||||||
| 74 | 0 | ▶ | warn $@ if $options->{verbose}; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 75 | 0 | $results = { failed => $@ }; | |||||||||
| 76 | } | ||||||||||
| 77 | |||||||||||
| 78 | 0 | return $results; | |||||||||
| 79 | } | ||||||||||
| 80 | |||||||||||
| 81 | 1 | 1; | |||||||||
| 82 | |||||||||||
| 83 | __END__ | ||||||||||