« blib/lib/Benchmark/Perl/Formance/Plugin/AccessorsClassXSAccessor.pm
↑ Summary
blib/lib/Benchmark/Perl/Formance/Plugin/AccessorsClassAccessor.pm »
| 1 | package Benchmark::Perl::Formance::Plugin::AccessorsClassXSAccessorArray; | ||||||||||
| 2 | 1 | our $AUTHORITY = 'cpan:SCHWIGON'; | |||||||||
| 3 | # ABSTRACT: benchmark plugin - Compare OO'ish accessors | ||||||||||
| 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 | our $VERSION = "0.001"; | |||||||||
| 9 | |||||||||||
| 10 | ############################################################# | ||||||||||
| 11 | # # | ||||||||||
| 12 | # Benchmark Code ahead - Don't touch without strong reason! # | ||||||||||
| 13 | # # | ||||||||||
| 14 | ############################################################# | ||||||||||
| 15 | |||||||||||
| 16 | 1 | our $goal; | |||||||||
| 17 | 1 | our $count; | |||||||||
| 18 | |||||||||||
| 19 | 1 | ▶ | use Benchmark ':hireswallclock'; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 20 | |||||||||||
| 21 | use Class::XSAccessor::Array | ||||||||||
| 22 | 1 | ▶ | constructor => 'new', | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 23 | 1 | accessors => {"zomtec" => 42}; | |||||||||
| 24 | |||||||||||
| 25 | sub main | ||||||||||
| 26 | 0 | ▶ | { | ||||||||
|
Subroutine
main: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||
| 27 | 0 | my ($options) = @_; | |||||||||
| 28 | |||||||||||
| 29 | # ensure same values over all Accessors* plugins! | ||||||||||
| 30 | 0 | ▶ | $goal = $options->{fastmode} ? 100_000 : 2_000_000; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 31 | 0 | $count = 5; | |||||||||
| 32 | |||||||||||
| 33 | 0 | my $result; | |||||||||
| 34 | 0 | my $obj = __PACKAGE__->new; | |||||||||
| 35 | 0 | ▶ | my $t_get = timeit $count, sub { $result = $obj->zomtec() for 1..$goal }; | ||||||||
|
Subroutine
__ANON__: not called CC=2 SCAR=17.9
| |||||||||||
| 36 | 0 | ▶ | my $t_set = timeit $count, sub { $result = $obj->zomtec(23) for 1..$goal }; | ||||||||
|
Subroutine
__ANON__: not called CC=2 SCAR=17.9
| |||||||||||
| 37 | return { | ||||||||||
| 38 | 0 | get => { | |||||||||
| 39 | Benchmark => $t_get, | ||||||||||
| 40 | result => $result, | ||||||||||
| 41 | goal => $goal, | ||||||||||
| 42 | }, | ||||||||||
| 43 | set => { | ||||||||||
| 44 | Benchmark => $t_set, | ||||||||||
| 45 | result => $result, | ||||||||||
| 46 | goal => $goal, | ||||||||||
| 47 | }, | ||||||||||
| 48 | }; | ||||||||||
| 49 | } | ||||||||||
| 50 | |||||||||||
| 51 | 1 | 1; | |||||||||
| 52 | |||||||||||
| 53 | __END__ | ||||||||||