← Index
NYTProf Performance Profile   « line view »
For script/ponapi
  Run on Wed Feb 10 15:51:26 2016
Reported on Thu Feb 11 09:43:10 2016

Filename/usr/local/lib/perl/5.18.2/Class/MOP/Method/Constructor.pm
StatementsExecuted 1162 statements in 3.95ms
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
58221.86ms195msClass::MOP::Method::Constructor::::_generate_constructor_method_inlineClass::MOP::Method::Constructor::_generate_constructor_method_inline
3011595µs71.9msClass::MOP::Method::Constructor::::newClass::MOP::Method::Constructor::new
5811303µs35.3msClass::MOP::Method::Constructor::::_eval_environmentClass::MOP::Method::Constructor::_eval_environment
3011200µs200µsClass::MOP::Method::Constructor::::_newClass::MOP::Method::Constructor::_new
3011185µs71.0msClass::MOP::Method::Constructor::::_initialize_bodyClass::MOP::Method::Constructor::_initialize_body
11117µs42µsClass::MOP::Method::Constructor::::BEGIN@8Class::MOP::Method::Constructor::BEGIN@8
1119µs18µsClass::MOP::Method::Constructor::::BEGIN@4Class::MOP::Method::Constructor::BEGIN@4
1118µs11µsClass::MOP::Method::Constructor::::BEGIN@5Class::MOP::Method::Constructor::BEGIN@5
1117µs504µsClass::MOP::Method::Constructor::::BEGIN@10Class::MOP::Method::Constructor::BEGIN@10
1116µs31µsClass::MOP::Method::Constructor::::BEGIN@7Class::MOP::Method::Constructor::BEGIN@7
0000s0sClass::MOP::Method::Constructor::::__ANON__[:108]Class::MOP::Method::Constructor::__ANON__[:108]
0000s0sClass::MOP::Method::Constructor::::__ANON__[:115]Class::MOP::Method::Constructor::__ANON__[:115]
0000s0sClass::MOP::Method::Constructor::::__ANON__[:90]Class::MOP::Method::Constructor::__ANON__[:90]
0000s0sClass::MOP::Method::Constructor::::_generate_constructor_methodClass::MOP::Method::Constructor::_generate_constructor_method
Call graph for these subroutines as a Graphviz dot language file.
Line State
ments
Time
on line
Calls Time
in subs
Code
1package Class::MOP::Method::Constructor;
21500nsour $VERSION = '2.1604';
3
4220µs228µs
# spent 18µs (9+9) within Class::MOP::Method::Constructor::BEGIN@4 which was called: # once (9µs+9µs) by Class::MOP::Class::BEGIN@10 at line 4
use strict;
# spent 18µs making 1 call to Class::MOP::Method::Constructor::BEGIN@4 # spent 10µs making 1 call to strict::import
5222µs214µs
# spent 11µs (8+3) within Class::MOP::Method::Constructor::BEGIN@5 which was called: # once (8µs+3µs) by Class::MOP::Class::BEGIN@10 at line 5
use warnings;
# spent 11µs making 1 call to Class::MOP::Method::Constructor::BEGIN@5 # spent 3µs making 1 call to warnings::import
6
7220µs256µs
# spent 31µs (6+25) within Class::MOP::Method::Constructor::BEGIN@7 which was called: # once (6µs+25µs) by Class::MOP::Class::BEGIN@10 at line 7
use Scalar::Util 'blessed', 'weaken';
# spent 31µs making 1 call to Class::MOP::Method::Constructor::BEGIN@7 # spent 25µs making 1 call to Exporter::import
8228µs266µs
# spent 42µs (17+25) within Class::MOP::Method::Constructor::BEGIN@8 which was called: # once (17µs+25µs) by Class::MOP::Class::BEGIN@10 at line 8
use Try::Tiny;
# spent 42µs making 1 call to Class::MOP::Method::Constructor::BEGIN@8 # spent 25µs making 1 call to Exporter::import
9
102382µs21.00ms
# spent 504µs (7+497) within Class::MOP::Method::Constructor::BEGIN@10 which was called: # once (7µs+497µs) by Class::MOP::Class::BEGIN@10 at line 10
use parent 'Class::MOP::Method::Inlined';
# spent 504µs making 1 call to Class::MOP::Method::Constructor::BEGIN@10 # spent 497µs making 1 call to parent::import
11
12
# spent 71.9ms (595µs+71.3) within Class::MOP::Method::Constructor::new which was called 30 times, avg 2.40ms/call: # 30 times (595µs+71.3ms) by Class::MOP::Class::_inline_constructor at line 1453 of Class/MOP/Class.pm, avg 2.40ms/call
sub new {
133011µs my $class = shift;
143053µs my %options = @_;
15
1630172µs6048µs (blessed $options{metaclass} && $options{metaclass}->isa('Class::MOP::Class'))
# spent 24µs making 30 calls to Scalar::Util::blessed, avg 810ns/call # spent 24µs making 30 calls to UNIVERSAL::isa, avg 807ns/call
17 || $class->_throw_exception( MustSupplyAMetaclass => params => \%options,
18 class => $class
19 )
20 if $options{is_inline};
21
223014µs ($options{package_name} && $options{name})
23 || $class->_throw_exception( MustSupplyPackageNameAndName => params => \%options,
24 class => $class
25 );
26
273051µs30200µs my $self = $class->_new(\%options);
# spent 200µs making 30 calls to Class::MOP::Method::Constructor::_new, avg 7µs/call
28
29 # we don't want this creating
30 # a cycle in the code, if not
31 # needed
3230200µs3028µs weaken($self->{'associated_metaclass'});
# spent 28µs making 30 calls to Scalar::Util::weaken, avg 933ns/call
33
343035µs3071.0ms $self->_initialize_body;
# spent 71.0ms making 30 calls to Class::MOP::Method::Constructor::_initialize_body, avg 2.37ms/call
35
363081µs return $self;
37}
38
39
# spent 200µs within Class::MOP::Method::Constructor::_new which was called 30 times, avg 7µs/call: # 30 times (200µs+0s) by Class::MOP::Method::Constructor::new at line 27, avg 7µs/call
sub _new {
40308µs my $class = shift;
41
42307µs return Class::MOP::Class->initialize($class)->new_object(@_)
43 if $class ne __PACKAGE__;
44
453014µs my $params = @_ == 1 ? $_[0] : {@_};
46
4730204µs return bless {
48 # inherited from Class::MOP::Method
49 body => $params->{body},
50 # associated_metaclass => $params->{associated_metaclass}, # overridden
51 package_name => $params->{package_name},
52 name => $params->{name},
53 original_method => $params->{original_method},
54
55 # inherited from Class::MOP::Generated
56 is_inline => $params->{is_inline} || 0,
57 definition_context => $params->{definition_context},
58
59 # inherited from Class::MOP::Inlined
60 _expected_method_class => $params->{_expected_method_class},
61
62 # defined in this subclass
63 options => $params->{options} || {},
64 associated_metaclass => $params->{metaclass},
65 }, $class;
66}
67
68## accessors
69
7058142µssub options { (shift)->{'options'} }
7190182µssub associated_metaclass { (shift)->{'associated_metaclass'} }
72
73## method
74
75
# spent 71.0ms (185µs+70.8) within Class::MOP::Method::Constructor::_initialize_body which was called 30 times, avg 2.37ms/call: # 30 times (185µs+70.8ms) by Class::MOP::Method::Constructor::new at line 34, avg 2.37ms/call
sub _initialize_body {
76305µs my $self = shift;
77306µs my $method_name = '_generate_constructor_method';
78
793069µs3015µs $method_name .= '_inline' if $self->is_inline;
# spent 15µs making 30 calls to Class::MOP::Method::Generated::is_inline, avg 513ns/call
80
8130127µs3070.8ms $self->{'body'} = $self->$method_name;
# spent 70.8ms making 30 calls to Class::MOP::Method::Constructor::_generate_constructor_method_inline, avg 2.36ms/call
82}
83
84
# spent 35.3ms (303µs+35.0) within Class::MOP::Method::Constructor::_eval_environment which was called 58 times, avg 609µs/call: # 58 times (303µs+35.0ms) by Class::MOP::Method::Generated::_compile_code at line 52 of Class/MOP/Method/Generated.pm, avg 609µs/call
sub _eval_environment {
855814µs my $self = shift;
8658221µs11635.0ms return $self->associated_metaclass->_eval_environment;
# spent 26.6ms making 28 calls to Moose::Meta::Class::_eval_environment, avg 949µs/call # spent 8.36ms making 30 calls to Class::MOP::Class::_eval_environment, avg 279µs/call # spent 31µs making 28 calls to Class::MOP::Method::associated_metaclass, avg 1µs/call # spent 27µs making 30 calls to Class::MOP::Method::Constructor::associated_metaclass, avg 897ns/call
87}
88
89sub _generate_constructor_method {
90 return sub { Class::MOP::Class->initialize(shift)->new_object(@_) }
91}
92
93
# spent 195ms (1.86+193) within Class::MOP::Method::Constructor::_generate_constructor_method_inline which was called 58 times, avg 3.37ms/call: # 30 times (810µs+70.0ms) by Class::MOP::Method::Constructor::_initialize_body at line 81, avg 2.36ms/call # 28 times (1.05ms+123ms) by Moose::Meta::Method::Constructor::_initialize_body at line 54 of Moose/Meta/Method/Constructor.pm, avg 4.45ms/call
sub _generate_constructor_method_inline {
945814µs my $self = shift;
95
965888µs5868µs my $meta = $self->associated_metaclass;
# spent 45µs making 28 calls to Class::MOP::Method::associated_metaclass, avg 2µs/call # spent 24µs making 30 calls to Class::MOP::Method::Constructor::associated_metaclass, avg 790ns/call
97
9858444µs58114ms my @source = (
# spent 114ms making 58 calls to Class::MOP::Class::_inline_new_object, avg 1.96ms/call
99 'sub {',
100 $meta->_inline_new_object,
101 '}',
102 );
103
10458149µs5893µs warn join("\n", @source) if $self->options->{debug};
# spent 93µs making 58 calls to Class::MOP::Method::Constructor::options, avg 2µs/call
105
106 my $code = try {
10758190µs5878.0ms $self->_compile_code(\@source);
# spent 78.0ms making 58 calls to Class::MOP::Method::Generated::_compile_code, avg 1.34ms/call
108 }
109 catch {
110 my $source = join("\n", @source);
111 $self->_throw_exception( CouldNotEvalConstructor => constructor_method => $self,
112 source => $source,
113 error => $_
114 );
11558663µs11679.5ms };
# spent 79.3ms making 58 calls to Try::Tiny::try, avg 1.37ms/call # spent 200µs making 58 calls to Try::Tiny::catch, avg 3µs/call
116
11758309µs return $code;
118}
119
12012µs1;
121
122# ABSTRACT: Method Meta Object for constructors
123
124__END__