← Index
NYTProf Performance Profile   « block view • line view • sub view »
For mentat.storage.mongo.pl
  Run on Tue Jun 24 09:58:41 2014
Reported on Tue Jun 24 09:59:20 2014

Filename/usr/local/lib/perl/5.14.2/Class/MOP/Method/Constructor.pm
StatementsExecuted 936 statements in 3.12ms
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
35221.01ms74.7msClass::MOP::Method::Constructor::::_generate_constructor_method_inlineClass::MOP::Method::Constructor::_generate_constructor_method_inline
3011433µs44.4msClass::MOP::Method::Constructor::::newClass::MOP::Method::Constructor::new
3011416µs416µsClass::MOP::Method::Constructor::::_newClass::MOP::Method::Constructor::_new
3011184µs43.5msClass::MOP::Method::Constructor::::_initialize_bodyClass::MOP::Method::Constructor::_initialize_body
3511170µs7.94msClass::MOP::Method::Constructor::::_eval_environmentClass::MOP::Method::Constructor::_eval_environment
11112µs15µsClass::MOP::Method::Constructor::::BEGIN@10Class::MOP::Method::Constructor::BEGIN@10
1119µs38µsClass::MOP::Method::Constructor::::BEGIN@14Class::MOP::Method::Constructor::BEGIN@14
1118µs8µsClass::MOP::Method::Constructor::::BEGIN@3Class::MOP::Method::Constructor::BEGIN@3
1117µs13µsClass::MOP::Method::Constructor::::BEGIN@11Class::MOP::Method::Constructor::BEGIN@11
1117µs42µsClass::MOP::Method::Constructor::::BEGIN@15Class::MOP::Method::Constructor::BEGIN@15
1117µs747µsClass::MOP::Method::Constructor::::BEGIN@17Class::MOP::Method::Constructor::BEGIN@17
1117µs34µsClass::MOP::Method::Constructor::::BEGIN@13Class::MOP::Method::Constructor::BEGIN@13
0000s0sClass::MOP::Method::Constructor::::__ANON__[:111]Class::MOP::Method::Constructor::__ANON__[:111]
0000s0sClass::MOP::Method::Constructor::::__ANON__[:115]Class::MOP::Method::Constructor::__ANON__[:115]
0000s0sClass::MOP::Method::Constructor::::__ANON__[:93]Class::MOP::Method::Constructor::__ANON__[:93]
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
# spent 8µs within Class::MOP::Method::Constructor::BEGIN@3 which was called: # once (8µs+0s) by Class::MOP::Class::BEGIN@16 at line 5
BEGIN {
415µs $Class::MOP::Method::Constructor::AUTHORITY = 'cpan:STEVAN';
5130µs18µs}
# spent 8µs making 1 call to Class::MOP::Method::Constructor::BEGIN@3
6{
721µs $Class::MOP::Method::Constructor::VERSION = '2.1005';
8}
9
10224µs218µs
# spent 15µs (12+3) within Class::MOP::Method::Constructor::BEGIN@10 which was called: # once (12µs+3µs) by Class::MOP::Class::BEGIN@16 at line 10
use strict;
# spent 15µs making 1 call to Class::MOP::Method::Constructor::BEGIN@10 # spent 3µs making 1 call to strict::import
11223µs218µs
# spent 13µs (7+5) within Class::MOP::Method::Constructor::BEGIN@11 which was called: # once (7µs+5µs) by Class::MOP::Class::BEGIN@16 at line 11
use warnings;
# spent 13µs making 1 call to Class::MOP::Method::Constructor::BEGIN@11 # spent 5µs making 1 call to warnings::import
12
13227µs261µs
# spent 34µs (7+27) within Class::MOP::Method::Constructor::BEGIN@13 which was called: # once (7µs+27µs) by Class::MOP::Class::BEGIN@16 at line 13
use Carp 'confess';
# spent 34µs making 1 call to Class::MOP::Method::Constructor::BEGIN@13 # spent 27µs making 1 call to Exporter::import
14224µs267µs
# spent 38µs (9+29) within Class::MOP::Method::Constructor::BEGIN@14 which was called: # once (9µs+29µs) by Class::MOP::Class::BEGIN@16 at line 14
use Scalar::Util 'blessed', 'weaken';
# spent 38µs making 1 call to Class::MOP::Method::Constructor::BEGIN@14 # spent 29µs making 1 call to Exporter::import
15225µs276µs
# spent 42µs (7+34) within Class::MOP::Method::Constructor::BEGIN@15 which was called: # once (7µs+34µs) by Class::MOP::Class::BEGIN@16 at line 15
use Try::Tiny;
# spent 42µs making 1 call to Class::MOP::Method::Constructor::BEGIN@15 # spent 34µs making 1 call to Exporter::import
16
172441µs21.49ms
# spent 747µs (7+740) within Class::MOP::Method::Constructor::BEGIN@17 which was called: # once (7µs+740µs) by Class::MOP::Class::BEGIN@16 at line 17
use base 'Class::MOP::Method::Inlined';
# spent 747µs making 1 call to Class::MOP::Method::Constructor::BEGIN@17 # spent 740µs making 1 call to base::import
18
19
# spent 44.4ms (433µs+44.0) within Class::MOP::Method::Constructor::new which was called 30 times, avg 1.48ms/call: # 30 times (433µs+44.0ms) by Class::MOP::Class::_inline_constructor at line 1438 of Class/MOP/Class.pm, avg 1.48ms/call
sub new {
20240484µs my $class = shift;
21 my %options = @_;
22
236056µs (blessed $options{metaclass} && $options{metaclass}->isa('Class::MOP::Class'))
# spent 31µs making 30 calls to UNIVERSAL::isa, avg 1µs/call # spent 24µs making 30 calls to Scalar::Util::blessed, avg 810ns/call
24 || confess "You must pass a metaclass instance if you want to inline"
25 if $options{is_inline};
26
27 ($options{package_name} && $options{name})
28 || confess "You must supply the package_name and name parameters $Class::MOP::Method::UPGRADE_ERROR_TEXT";
29
3030416µs my $self = $class->_new(\%options);
# spent 416µs making 30 calls to Class::MOP::Method::Constructor::_new, avg 14µs/call
31
32 # we don't want this creating
33 # a cycle in the code, if not
34 # needed
353030µs weaken($self->{'associated_metaclass'});
# spent 30µs making 30 calls to Scalar::Util::weaken, avg 997ns/call
36
373043.5ms $self->_initialize_body;
# spent 43.5ms making 30 calls to Class::MOP::Method::Constructor::_initialize_body, avg 1.45ms/call
38
39 return $self;
40}
41
42
# spent 416µs within Class::MOP::Method::Constructor::_new which was called 30 times, avg 14µs/call: # 30 times (416µs+0s) by Class::MOP::Method::Constructor::new at line 30, avg 14µs/call
sub _new {
43120447µs my $class = shift;
44
45 return Class::MOP::Class->initialize($class)->new_object(@_)
46 if $class ne __PACKAGE__;
47
48 my $params = @_ == 1 ? $_[0] : {@_};
49
50 return bless {
51 # inherited from Class::MOP::Method
52 body => $params->{body},
53 # associated_metaclass => $params->{associated_metaclass}, # overridden
54 package_name => $params->{package_name},
55 name => $params->{name},
56 original_method => $params->{original_method},
57
58 # inherited from Class::MOP::Generated
59 is_inline => $params->{is_inline} || 0,
60 definition_context => $params->{definition_context},
61
62 # inherited from Class::MOP::Inlined
63 _expected_method_class => $params->{_expected_method_class},
64
65 # defined in this subclass
66 options => $params->{options} || {},
67 associated_metaclass => $params->{metaclass},
68 }, $class;
69}
70
71## accessors
72
733582µssub options { (shift)->{'options'} }
7490190µssub associated_metaclass { (shift)->{'associated_metaclass'} }
75
76## method
77
78
# spent 43.5ms (184µs+43.3) within Class::MOP::Method::Constructor::_initialize_body which was called 30 times, avg 1.45ms/call: # 30 times (184µs+43.3ms) by Class::MOP::Method::Constructor::new at line 37, avg 1.45ms/call
sub _initialize_body {
79120201µs my $self = shift;
80 my $method_name = '_generate_constructor_method';
81
823021µs $method_name .= '_inline' if $self->is_inline;
# spent 21µs making 30 calls to Class::MOP::Method::Generated::is_inline, avg 707ns/call
83
843043.3ms $self->{'body'} = $self->$method_name;
# spent 43.3ms making 30 calls to Class::MOP::Method::Constructor::_generate_constructor_method_inline, avg 1.44ms/call
85}
86
87
# spent 7.94ms (170µs+7.77) within Class::MOP::Method::Constructor::_eval_environment which was called 35 times, avg 227µs/call: # 35 times (170µs+7.77ms) by Class::MOP::Method::Generated::_compile_code at line 59 of Class/MOP/Method/Generated.pm, avg 227µs/call
sub _eval_environment {
8870128µs my $self = shift;
89707.77ms return $self->associated_metaclass->_eval_environment;
# spent 4.97ms making 30 calls to Class::MOP::Class::_eval_environment, avg 166µs/call # spent 2.76ms making 5 calls to Moose::Meta::Class::_eval_environment, avg 552µs/call # spent 31µs making 30 calls to Class::MOP::Method::Constructor::associated_metaclass, avg 1µs/call # spent 9µs making 5 calls to Class::MOP::Method::associated_metaclass, avg 2µs/call
90}
91
92sub _generate_constructor_method {
93 return sub { Class::MOP::Class->initialize(shift)->new_object(@_) }
94}
95
96
# spent 74.7ms (1.01+73.7) within Class::MOP::Method::Constructor::_generate_constructor_method_inline which was called 35 times, avg 2.13ms/call: # 30 times (813µs+42.4ms) by Class::MOP::Method::Constructor::_initialize_body at line 84, avg 1.44ms/call # 5 times (199µs+31.3ms) by Moose::Meta::Method::Constructor::_initialize_body at line 57 of Moose/Meta/Method/Constructor.pm, avg 6.29ms/call
sub _generate_constructor_method_inline {
97210881µs my $self = shift;
98
993533µs my $meta = $self->associated_metaclass;
# spent 28µs making 30 calls to Class::MOP::Method::Constructor::associated_metaclass, avg 930ns/call # spent 6µs making 5 calls to Class::MOP::Method::associated_metaclass, avg 1µs/call
100
1013547.5ms my @source = (
# spent 47.5ms making 35 calls to Class::MOP::Class::_inline_new_object, avg 1.36ms/call
102 'sub {',
103 $meta->_inline_new_object,
104 '}',
105 );
106
1073545µs warn join("\n", @source) if $self->options->{debug};
# spent 45µs making 35 calls to Class::MOP::Method::Constructor::options, avg 1µs/call
108
109 my $code = try {
11035101µs3525.1ms $self->_compile_code(\@source);
# spent 25.1ms making 35 calls to Class::MOP::Method::Generated::_compile_code, avg 718µs/call
111 }
112 catch {
113 my $source = join("\n", @source);
114 confess "Could not eval the constructor :\n\n$source\n\nbecause :\n\n$_";
1157026.1ms };
# spent 26.0ms making 35 calls to Try::Tiny::try, avg 742µs/call # spent 113µs making 35 calls to Try::Tiny::catch, avg 3µs/call
116
117 return $code;
118}
119
12012µs1;
121
122# ABSTRACT: Method Meta Object for constructors
123
124__END__