← Index
NYTProf Performance Profile   « line view »
For examples/Atom-timer.pl
  Run on Mon Aug 12 14:45:28 2013
Reported on Mon Aug 12 14:46:15 2013

Filename/Users/dde/perl5/perlbrew/perls/5.18.0t/lib/site_perl/5.18.0/MooseX/Storage.pm
StatementsExecuted 44 statements in 644µs
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
111402µs690µsMooseX::Storage::::BEGIN@13MooseX::Storage::BEGIN@13
111228µs14.2msMooseX::Storage::::BEGIN@12MooseX::Storage::BEGIN@12
33147µs27.7msMooseX::Storage::::_expand_roleMooseX::Storage::_expand_role
11120µs269µsMooseX::Storage::::importMooseX::Storage::import
11118µs27.7msMooseX::Storage::::_injected_storage_role_generatorMooseX::Storage::_injected_storage_role_generator
21111µs67µsMooseX::Storage::::_rewrite_role_nameMooseX::Storage::_rewrite_role_name
1117µs7µsMooseX::Storage::::BEGIN@7MooseX::Storage::BEGIN@7
1117µs5.53msMooseX::Storage::::BEGIN@10MooseX::Storage::BEGIN@10
Call graph for these subroutines as a Graphviz dot language file.
Line State
ments
Time
on line
Calls Time
in subs
Code
1package MooseX::Storage;
2{
32800ns $MooseX::Storage::VERSION = '0.39';
4}
5# git description: v0.38-TRIAL-2-g769dd9c
6
7
# spent 7µs within MooseX::Storage::BEGIN@7 which was called: # once (7µs+0s) by Atom::BEGIN@6 at line 9
BEGIN {
814µs $MooseX::Storage::AUTHORITY = 'cpan:STEVAN';
9118µs17µs}
# spent 7µs making 1 call to MooseX::Storage::BEGIN@7
10231µs211.1ms
# spent 5.53ms (7µs+5.53) within MooseX::Storage::BEGIN@10 which was called: # once (7µs+5.53ms) by Atom::BEGIN@6 at line 10
use Moose qw(confess);
# spent 5.53ms making 1 call to MooseX::Storage::BEGIN@10 # spent 5.53ms making 1 call to Moose::Exporter::__ANON__[Moose/Exporter.pm:519]
11
122124µs114.2ms
# spent 14.2ms (228µs+14.0) within MooseX::Storage::BEGIN@12 which was called: # once (228µs+14.0ms) by Atom::BEGIN@6 at line 12
use MooseX::Storage::Meta::Attribute::DoNotSerialize;
# spent 14.2ms making 1 call to MooseX::Storage::BEGIN@12
132386µs1690µs
# spent 690µs (402+288) within MooseX::Storage::BEGIN@13 which was called: # once (402µs+288µs) by Atom::BEGIN@6 at line 13
use String::RewritePrefix ();
# spent 690µs making 1 call to MooseX::Storage::BEGIN@13
14
15
# spent 269µs (20+249) within MooseX::Storage::import which was called: # once (20µs+249µs) by Atom::BEGIN@6 at line 6 of lib/HackaMol/Atom.pm
sub import {
161500ns my $pkg = caller();
17
181200ns return if $pkg eq 'main';
19
2017µs11µs ($pkg->can('meta'))
# spent 1µs making 1 call to UNIVERSAL::can
21 || confess "This package can only be used in Moose based classes";
22
2316µs4248µs $pkg->meta->add_method('Storage' => __PACKAGE__->meta->find_method_by_name('_injected_storage_role_generator'));
# spent 147µs making 1 call to Class::MOP::Class::find_method_by_name # spent 80µs making 1 call to Class::MOP::Mixin::HasMethods::add_method # spent 12µs making 1 call to Atom::meta # spent 9µs making 1 call to MooseX::Storage::meta
24}
25
261100nsmy %HORRIBLE_GC_AVOIDANCE_HACK;
27
28
# spent 67µs (11+55) within MooseX::Storage::_rewrite_role_name which was called 2 times, avg 33µs/call: # 2 times (11µs+55µs) by MooseX::Storage::_expand_role at line 57, avg 33µs/call
sub _rewrite_role_name {
292600ns my ($self, $base, $string) = @_;
30
31210µs255µs my $role_name = scalar String::RewritePrefix->rewrite(
# spent 55µs making 2 calls to String::RewritePrefix::rewrite, avg 28µs/call
32 {
33 '' => "MooseX::Storage::$base\::",
34 '=' => '',
35 },
36 $string,
37 );
38}
39
40
# spent 27.7ms (47µs+27.6) within MooseX::Storage::_expand_role which was called 3 times, avg 9.22ms/call: # once (26µs+22.8ms) by MooseX::Storage::_injected_storage_role_generator at line 79 # once (19µs+4.79ms) by MooseX::Storage::_injected_storage_role_generator at line 98 # once (2µs+0s) by MooseX::Storage::_injected_storage_role_generator at line 85
sub _expand_role {
4131µs my ($self, $base, $value) = @_;
42
4333µs return unless defined $value;
44
452300ns if (ref $value) {
46 confess "too many args in arrayref role declaration" if @$value > 2;
47 my ($class, $param) = @$value;
48
49 $class = $self->_rewrite_role_name($base => $class);
50 Class::MOP::load_class($class);
51
52 my $role = $class->meta->generate_role(parameters => $param);
53
54 $HORRIBLE_GC_AVOIDANCE_HACK{ $role->name } = $role;
55 return $role->name;
56 } else {
57212µs267µs my $class = $self->_rewrite_role_name($base, $value);
# spent 67µs making 2 calls to MooseX::Storage::_rewrite_role_name, avg 33µs/call
5822µs24µs Class::MOP::load_class($class);
# spent 4µs making 2 calls to Class::MOP::load_class, avg 2µs/call
59
6021µs my $role = $class;
61
62212µs425µs if ($class->meta->isa(
# spent 12µs making 1 call to MooseX::Storage::Basic::meta # spent 11µs making 1 call to MooseX::Storage::IO::StorableFile::meta # spent 2µs making 2 calls to UNIVERSAL::isa, avg 1µs/call
63 'MooseX::Role::Parameterized::Meta::Role::Parameterizable'
64 )) {
65 $role = $class->meta->generate_role(parameters => undef);
66 $HORRIBLE_GC_AVOIDANCE_HACK{ $role->name } = $role;
67 return $role->name;
68 }
69
7026µs return $class;
71 }
72}
73
74
# spent 27.7ms (18µs+27.7) within MooseX::Storage::_injected_storage_role_generator which was called: # once (18µs+27.7ms) by main::BEGIN@5 at line 7 of lib/HackaMol/Atom.pm
sub _injected_storage_role_generator {
7511µs my %params = @_;
76
771600ns $params{base} = '=MooseX::Storage::Basic' unless defined $params{base};
78
7912µs122.8ms my @roles = __PACKAGE__->_expand_role(Base => $params{base});
# spent 22.8ms making 1 call to MooseX::Storage::_expand_role
80
81 # NOTE:
82 # you don't have to have a format
83 # role, this just means you dont
84 # get anything other than pack/unpack
8512µs12µs push @roles, __PACKAGE__->_expand_role(Format => $params{format});
# spent 2µs making 1 call to MooseX::Storage::_expand_role
86
87 # NOTE:
88 # many IO roles don't make sense unless
89 # you have also have a format role chosen
90 # too, the exception being StorableFile
91 #
92 # NOTE:
93 # we dont need this code anymore, cause
94 # the role composition will catch it for
95 # us. This allows the StorableFile to work
96 #(exists $params{'format'})
97 # || confess "You must specify a format role in order to use an IO role";
9811µs14.81ms push @roles, __PACKAGE__->_expand_role(IO => $params{io});
# spent 4.81ms making 1 call to MooseX::Storage::_expand_role
99
100 # Note:
101 # These traits alter the behaviour of the engine, the user can
102 # specify these per role-usage
10312µs for my $trait ( @{ $params{'traits'} ||= [] } ) {
104 push @roles, __PACKAGE__->_expand_role(Traits => $trait);
105 }
106
10714µs return @roles;
108}
109
11013µs1;
111
112__END__