← Index
NYTProf Performance Profile   « block view • line view • sub view »
For -e
  Run on Wed Nov 17 22:00:36 2010
Reported on Wed Nov 17 22:10:36 2010

Filename/home/doy/coding/src/Class-MOP/blib/lib//Class/MOP/Method/Constructor.pm
StatementsExecuted 2691 statements in 63.2ms
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
731118.4ms26.8msClass::MOP::Method::Constructor::::CORE:sortClass::MOP::Method::Constructor::CORE:sort (opcode)
732214.2ms759msClass::MOP::Method::Constructor::::_generate_constructor_method_inlineClass::MOP::Method::Constructor::_generate_constructor_method_inline
31115.38ms40.7msClass::MOP::Method::Constructor::::_eval_environmentClass::MOP::Method::Constructor::_eval_environment
73223.64ms57.5msClass::MOP::Method::Constructor::::_attributesClass::MOP::Method::Constructor::_attributes
31113.41ms312msClass::MOP::Method::Constructor::::newClass::MOP::Method::Constructor::new
31112.37ms2.37msClass::MOP::Method::Constructor::::_newClass::MOP::Method::Constructor::_new
73111.83ms243msClass::MOP::Method::Constructor::::__ANON__[:122]Class::MOP::Method::Constructor::__ANON__[:122]
31111.52ms306msClass::MOP::Method::Constructor::::_initialize_bodyClass::MOP::Method::Constructor::_initialize_body
11173µs280µsClass::MOP::Method::Constructor::::BEGIN@9Class::MOP::Method::Constructor::BEGIN@9
11169µs89µsClass::MOP::Method::Constructor::::BEGIN@4Class::MOP::Method::Constructor::BEGIN@4
11159µs128µsClass::MOP::Method::Constructor::::BEGIN@5Class::MOP::Method::Constructor::BEGIN@5
11144µs3.53msClass::MOP::Method::Constructor::::BEGIN@15Class::MOP::Method::Constructor::BEGIN@15
11140µs199µsClass::MOP::Method::Constructor::::BEGIN@8Class::MOP::Method::Constructor::BEGIN@8
11140µs217µsClass::MOP::Method::Constructor::::BEGIN@7Class::MOP::Method::Constructor::BEGIN@7
0000s0sClass::MOP::Method::Constructor::::__ANON__[:104]Class::MOP::Method::Constructor::__ANON__[:104]
0000s0sClass::MOP::Method::Constructor::::__ANON__[:126]Class::MOP::Method::Constructor::__ANON__[:126]
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
1
2package Class::MOP::Method::Constructor;
3
43102µs2108µs
# spent 89µs (69+20) within Class::MOP::Method::Constructor::BEGIN@4 which was called: # once (69µs+20µs) by Class::MOP::Class::BEGIN@10 at line 4
use strict;
# spent 89µs making 1 call to Class::MOP::Method::Constructor::BEGIN@4 # spent 20µs making 1 call to strict::import
53111µs2196µs
# spent 128µs (59+68) within Class::MOP::Method::Constructor::BEGIN@5 which was called: # once (59µs+68µs) by Class::MOP::Class::BEGIN@10 at line 5
use warnings;
# spent 128µs making 1 call to Class::MOP::Method::Constructor::BEGIN@5 # spent 68µs making 1 call to warnings::import
6
73117µs2393µs
# spent 217µs (40+177) within Class::MOP::Method::Constructor::BEGIN@7 which was called: # once (40µs+177µs) by Class::MOP::Class::BEGIN@10 at line 7
use Carp 'confess';
# spent 217µs making 1 call to Class::MOP::Method::Constructor::BEGIN@7 # spent 177µs making 1 call to Exporter::import
8399µs2358µs
# spent 199µs (40+159) within Class::MOP::Method::Constructor::BEGIN@8 which was called: # once (40µs+159µs) by Class::MOP::Class::BEGIN@10 at line 8
use Scalar::Util 'blessed', 'weaken';
# spent 199µs making 1 call to Class::MOP::Method::Constructor::BEGIN@8 # spent 159µs making 1 call to Exporter::import
93227µs2486µs
# spent 280µs (73+207) within Class::MOP::Method::Constructor::BEGIN@9 which was called: # once (73µs+207µs) by Class::MOP::Class::BEGIN@10 at line 9
use Try::Tiny;
# spent 280µs making 1 call to Class::MOP::Method::Constructor::BEGIN@9 # spent 207µs making 1 call to Exporter::import
10
1115µsour $VERSION = '1.11';
12161µs$VERSION = eval $VERSION;
# spent 11µs executing statements in string eval
1314µsour $AUTHORITY = 'cpan:STEVAN';
14
1532.03ms23.53ms
# spent 3.53ms (44µs+3.49) within Class::MOP::Method::Constructor::BEGIN@15 which was called: # once (44µs+3.49ms) by Class::MOP::Class::BEGIN@10 at line 15
use base 'Class::MOP::Method::Inlined';
# spent 3.53ms making 1 call to Class::MOP::Method::Constructor::BEGIN@15 # spent 3.49ms making 1 call to base::import, recursion: max depth 1, sum of overlapping time 3.49ms
16
17
# spent 312ms (3.41+309) within Class::MOP::Method::Constructor::new which was called 31 times, avg 10.1ms/call: # 31 times (3.41ms+309ms) by Class::MOP::Class::_inline_constructor at line 1471 of Class/MOP/Class.pm, avg 10.1ms/call
sub new {
182483.97ms my $class = shift;
19 my %options = @_;
20
2162455µs (blessed $options{metaclass} && $options{metaclass}->isa('Class::MOP::Class'))
# spent 229µs making 31 calls to Scalar::Util::blessed, avg 7µs/call # spent 226µs making 31 calls to UNIVERSAL::isa, avg 7µs/call
22 || confess "You must pass a metaclass instance if you want to inline"
23 if $options{is_inline};
24
25 ($options{package_name} && $options{name})
26 || confess "You must supply the package_name and name parameters $Class::MOP::Method::UPGRADE_ERROR_TEXT";
27
28312.37ms my $self = $class->_new(\%options);
# spent 2.37ms making 31 calls to Class::MOP::Method::Constructor::_new, avg 76µs/call
29
30 # we don't want this creating
31 # a cycle in the code, if not
32 # needed
3331246µs weaken($self->{'associated_metaclass'});
# spent 246µs making 31 calls to Scalar::Util::weaken, avg 8µs/call
34
3531306ms $self->_initialize_body;
# spent 306ms making 31 calls to Class::MOP::Method::Constructor::_initialize_body, avg 9.86ms/call
36
37 return $self;
38}
39
40
# spent 2.37ms within Class::MOP::Method::Constructor::_new which was called 31 times, avg 76µs/call: # 31 times (2.37ms+0s) by Class::MOP::Method::Constructor::new at line 28, avg 76µs/call
sub _new {
411242.53ms my $class = shift;
42
43 return Class::MOP::Class->initialize($class)->new_object(@_)
44 if $class ne __PACKAGE__;
45
46 my $params = @_ == 1 ? $_[0] : {@_};
47
48 return bless {
49 # inherited from Class::MOP::Method
50 body => $params->{body},
51 # associated_metaclass => $params->{associated_metaclass}, # overriden
52 package_name => $params->{package_name},
53 name => $params->{name},
54 original_method => $params->{original_method},
55
56 # inherited from Class::MOP::Generated
57 is_inline => $params->{is_inline} || 0,
58 definition_context => $params->{definition_context},
59
60 # inherited from Class::MOP::Inlined
61 _expected_method_class => $params->{_expected_method_class},
62
63 # defined in this subclass
64 options => $params->{options} || {},
65 associated_metaclass => $params->{metaclass},
66 }, $class;
67}
68
69## accessors
70
71731.32mssub options { (shift)->{'options'} }
72931.28mssub associated_metaclass { (shift)->{'associated_metaclass'} }
73
74## cached values ...
75
76
# spent 57.5ms (3.64+53.9) within Class::MOP::Method::Constructor::_attributes which was called 73 times, avg 788µs/call: # 42 times (2.10ms+23.6ms) by Moose::Meta::Method::Constructor::_eval_environment at line 58 of Moose/Meta/Method/Constructor.pm, avg 613µs/call # 31 times (1.54ms+30.3ms) by Class::MOP::Method::Constructor::_eval_environment at line 97, avg 1.03ms/call
sub _attributes {
77113630.3ms my $self = shift;
7819808.37ms $self->{'attributes'} ||= [
# spent 8.37ms making 1980 calls to Class::MOP::Mixin::AttributeCore::name, avg 4µs/call
7921953.9ms sort { $a->name cmp $b->name }
# spent 26.8ms making 73 calls to Class::MOP::Method::Constructor::CORE:sort, avg 367µs/call # spent 26.4ms making 73 calls to Class::MOP::Class::get_all_attributes, avg 361µs/call # spent 451µs making 42 calls to Class::MOP::Method::associated_metaclass, avg 11µs/call # spent 285µs making 31 calls to Class::MOP::Method::Constructor::associated_metaclass, avg 9µs/call
80 $self->associated_metaclass->get_all_attributes
81 ]
82}
83
84## method
85
86
# spent 306ms (1.52+304) within Class::MOP::Method::Constructor::_initialize_body which was called 31 times, avg 9.86ms/call: # 31 times (1.52ms+304ms) by Class::MOP::Method::Constructor::new at line 35, avg 9.86ms/call
sub _initialize_body {
871241.67ms my $self = shift;
88 my $method_name = '_generate_constructor_method';
89
9031195µs $method_name .= '_inline' if $self->is_inline;
# spent 195µs making 31 calls to Class::MOP::Method::Generated::is_inline, avg 6µs/call
91
9231304ms $self->{'body'} = $self->$method_name;
# spent 304ms making 31 calls to Class::MOP::Method::Constructor::_generate_constructor_method_inline, avg 9.81ms/call
93}
94
95
# spent 40.7ms (5.38+35.3) within Class::MOP::Method::Constructor::_eval_environment which was called 31 times, avg 1.31ms/call: # 31 times (5.38ms+35.3ms) by Class::MOP::Method::Generated::_compile_code at line 47 of Class/MOP/Method/Generated.pm, avg 1.31ms/call
sub _eval_environment {
96931.83ms my $self = shift;
972672.62ms29835.3ms my $defaults = [map { $_->default } @{ $self->_attributes }];
# spent 31.8ms making 31 calls to Class::MOP::Method::Constructor::_attributes, avg 1.03ms/call # spent 3.53ms making 267 calls to Class::MOP::Mixin::AttributeCore::default, avg 13µs/call
98 return {
99 '$defaults' => \$defaults,
100 };
101}
102
103sub _generate_constructor_method {
104 return sub { Class::MOP::Class->initialize(shift)->new_object(@_) }
105}
106
107
# spent 759ms (14.2+745) within Class::MOP::Method::Constructor::_generate_constructor_method_inline which was called 73 times, avg 10.4ms/call: # 42 times (8.52ms+446ms) by Moose::Meta::Method::Constructor::_initialize_body at line 52 of Moose/Meta/Method/Constructor.pm, avg 10.8ms/call # 31 times (5.68ms+298ms) by Class::MOP::Method::Constructor::_initialize_body at line 92, avg 9.81ms/call
sub _generate_constructor_method_inline {
10843813.2ms my $self = shift;
109
11073741µs my $meta = $self->associated_metaclass;
# spent 446µs making 42 calls to Class::MOP::Method::associated_metaclass, avg 11µs/call # spent 295µs making 31 calls to Class::MOP::Method::Constructor::associated_metaclass, avg 10µs/call
111
11273491ms my @source = (
# spent 491ms making 73 calls to Class::MOP::Class::_inline_new_object, avg 6.73ms/call
113 'sub {',
114 $meta->_inline_new_object,
115 '}',
116 );
117
11873984µs warn join("\n", @source) if $self->options->{debug};
# spent 984µs making 73 calls to Class::MOP::Method::Constructor::options, avg 13µs/call
119
120
# spent 243ms (1.83+241) within Class::MOP::Method::Constructor::__ANON__[/home/doy/coding/src/Class-MOP/blib/lib//Class/MOP/Method/Constructor.pm:122] which was called 73 times, avg 3.33ms/call: # 73 times (1.83ms+241ms) by Try::Tiny::try at line 71 of Try/Tiny.pm, avg 3.33ms/call
my $code = try {
121731.70ms73241ms $self->_compile_code(\@source);
# spent 241ms making 73 calls to Class::MOP::Method::Generated::_compile_code, avg 3.30ms/call
122 }
123 catch {
124 my $source = join("\n", @source);
125 confess "Could not eval the constructor :\n\n$source\n\nbecause :\n\n$_";
126146123ms };
# spent 250ms making 73 calls to Try::Tiny::try, avg 3.43ms/call, recursion: max depth 2, sum of overlapping time 129ms # spent 1.67ms making 73 calls to Try::Tiny::catch, avg 23µs/call
127
128 return $code;
129}
130
131111µs1;
132
133__END__
 
# spent 26.8ms (18.4+8.37) within Class::MOP::Method::Constructor::CORE:sort which was called 73 times, avg 367µs/call: # 73 times (18.4ms+8.37ms) by Class::MOP::Method::Constructor::_attributes at line 79, avg 367µs/call
sub Class::MOP::Method::Constructor::CORE:sort; # opcode