← Index
NYTProf Performance Profile   « line view »
For /home/ss5/perl5/perlbrew/perls/perl-5.22.0/bin/benchmarkanything-storage
  Run on Mon Jan 29 16:55:34 2018
Reported on Mon Jan 29 16:57:06 2018

Filename/home/ss5/perl5/perlbrew/perls/perl-5.22.0/lib/site_perl/5.22.0/x86_64-linux/Class/MOP/Method/Constructor.pm
StatementsExecuted 892 statements in 1.88ms
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
3122589µs49.2msClass::MOP::Method::Constructor::::_generate_constructor_method_inlineClass::MOP::Method::Constructor::_generate_constructor_method_inline
3011388µs48.0msClass::MOP::Method::Constructor::::newClass::MOP::Method::Constructor::new
3011166µs47.4msClass::MOP::Method::Constructor::::_initialize_bodyClass::MOP::Method::Constructor::_initialize_body
3011134µs134µsClass::MOP::Method::Constructor::::_newClass::MOP::Method::Constructor::_new
311199µs3.26msClass::MOP::Method::Constructor::::_eval_environmentClass::MOP::Method::Constructor::_eval_environment
311160µs10.9msClass::MOP::Method::Constructor::::try {...} Class::MOP::Method::Constructor::try {...}
1119µs11µsClass::MOP::Method::Constructor::::BEGIN@4Class::MOP::Method::Constructor::BEGIN@4
1116µs440µsClass::MOP::Method::Constructor::::BEGIN@10Class::MOP::Method::Constructor::BEGIN@10
1114µs9µsClass::MOP::Method::Constructor::::BEGIN@5Class::MOP::Method::Constructor::BEGIN@5
1114µs25µsClass::MOP::Method::Constructor::::BEGIN@7Class::MOP::Method::Constructor::BEGIN@7
1114µs20µsClass::MOP::Method::Constructor::::BEGIN@8Class::MOP::Method::Constructor::BEGIN@8
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
0000s0sClass::MOP::Method::Constructor::::catch {...} Class::MOP::Method::Constructor::catch {...}
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;
21300nsour $VERSION = '2.1605';
3
4215µs213µs
# spent 11µs (9+2) within Class::MOP::Method::Constructor::BEGIN@4 which was called: # once (9µs+2µs) by Class::MOP::Class::BEGIN@10 at line 4
use strict;
# spent 11µs making 1 call to Class::MOP::Method::Constructor::BEGIN@4 # spent 2µs making 1 call to strict::import
5214µs213µs
# spent 9µs (4+4) within Class::MOP::Method::Constructor::BEGIN@5 which was called: # once (4µs+4µs) by Class::MOP::Class::BEGIN@10 at line 5
use warnings;
# spent 9µs making 1 call to Class::MOP::Method::Constructor::BEGIN@5 # spent 4µs making 1 call to warnings::import
6
7214µs246µs
# spent 25µs (4+21) within Class::MOP::Method::Constructor::BEGIN@7 which was called: # once (4µs+21µs) by Class::MOP::Class::BEGIN@10 at line 7
use Scalar::Util 'blessed', 'weaken';
# spent 25µs making 1 call to Class::MOP::Method::Constructor::BEGIN@7 # spent 21µs making 1 call to Exporter::import
8214µs236µs
# spent 20µs (4+16) within Class::MOP::Method::Constructor::BEGIN@8 which was called: # once (4µs+16µs) by Class::MOP::Class::BEGIN@10 at line 8
use Try::Tiny;
# spent 20µs making 1 call to Class::MOP::Method::Constructor::BEGIN@8 # spent 16µs making 1 call to Exporter::import
9
102269µs2874µs
# spent 440µs (6+434) within Class::MOP::Method::Constructor::BEGIN@10 which was called: # once (6µs+434µs) by Class::MOP::Class::BEGIN@10 at line 10
use parent 'Class::MOP::Method::Inlined';
# spent 440µs making 1 call to Class::MOP::Method::Constructor::BEGIN@10 # spent 434µs making 1 call to parent::import
11
12
# spent 48.0ms (388µs+47.6) within Class::MOP::Method::Constructor::new which was called 30 times, avg 1.60ms/call: # 30 times (388µs+47.6ms) by Class::MOP::Class::_inline_constructor at line 1464 of Class/MOP/Class.pm, avg 1.60ms/call
sub new {
13308µs my $class = shift;
143043µs my %options = @_;
15
16 (blessed $options{metaclass} && $options{metaclass}->isa('Class::MOP::Class'))
17 || $class->_throw_exception( MustSupplyAMetaclass => params => \%options,
18 class => $class
19 )
2030136µs6030µs if $options{is_inline};
# spent 15µs making 30 calls to Scalar::Util::blessed, avg 503ns/call # spent 15µs making 30 calls to UNIVERSAL::isa, avg 487ns/call
21
22 ($options{package_name} && $options{name})
233010µs || $class->_throw_exception( MustSupplyPackageNameAndName => params => \%options,
24 class => $class
25 );
26
273033µs30134µs my $self = $class->_new(\%options);
# spent 134µs making 30 calls to Class::MOP::Method::Constructor::_new, avg 4µs/call
28
29 # we don't want this creating
30 # a cycle in the code, if not
31 # needed
323097µs3016µs weaken($self->{'associated_metaclass'});
# spent 16µs making 30 calls to Scalar::Util::weaken, avg 550ns/call
33
343027µs3047.4ms $self->_initialize_body;
# spent 47.4ms making 30 calls to Class::MOP::Method::Constructor::_initialize_body, avg 1.58ms/call
35
363058µs return $self;
37}
38
39
# spent 134µs within Class::MOP::Method::Constructor::_new which was called 30 times, avg 4µs/call: # 30 times (134µs+0s) by Class::MOP::Method::Constructor::new at line 27, avg 4µs/call
sub _new {
40306µs my $class = shift;
41
42307µs return Class::MOP::Class->initialize($class)->new_object(@_)
43 if $class ne __PACKAGE__;
44
453015µs my $params = @_ == 1 ? $_[0] : {@_};
46
47 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},
6530127µs }, $class;
66}
67
68## accessors
69
703148µssub options { (shift)->{'options'} }
7190111µssub associated_metaclass { (shift)->{'associated_metaclass'} }
72
73## method
74
75
# spent 47.4ms (166µs+47.3) within Class::MOP::Method::Constructor::_initialize_body which was called 30 times, avg 1.58ms/call: # 30 times (166µs+47.3ms) by Class::MOP::Method::Constructor::new at line 34, avg 1.58ms/call
sub _initialize_body {
76305µs my $self = shift;
77307µs my $method_name = '_generate_constructor_method';
78
793050µs309µs $method_name .= '_inline' if $self->is_inline;
# spent 9µs making 30 calls to Class::MOP::Method::Generated::is_inline, avg 307ns/call
80
8130107µs3047.3ms $self->{'body'} = $self->$method_name;
# spent 47.3ms making 30 calls to Class::MOP::Method::Constructor::_generate_constructor_method_inline, avg 1.58ms/call
82}
83
84
# spent 3.26ms (99µs+3.16) within Class::MOP::Method::Constructor::_eval_environment which was called 31 times, avg 105µs/call: # 31 times (99µs+3.16ms) by Class::MOP::Method::Generated::_compile_code at line 52 of Class/MOP/Method/Generated.pm, avg 105µs/call
sub _eval_environment {
85316µs my $self = shift;
863177µs623.16ms return $self->associated_metaclass->_eval_environment;
# spent 2.94ms making 30 calls to Class::MOP::Class::_eval_environment, avg 98µs/call # spent 210µs making 1 call to Moose::Meta::Class::_eval_environment # spent 15µs making 30 calls to Class::MOP::Method::Constructor::associated_metaclass, avg 490ns/call # spent 500ns making 1 call to Class::MOP::Method::associated_metaclass
87}
88
89sub _generate_constructor_method {
90 return sub { Class::MOP::Class->initialize(shift)->new_object(@_) }
91}
92
93
# spent 49.2ms (589µs+48.6) within Class::MOP::Method::Constructor::_generate_constructor_method_inline which was called 31 times, avg 1.59ms/call: # 30 times (553µs+46.7ms) by Class::MOP::Method::Constructor::_initialize_body at line 81, avg 1.58ms/call # once (36µs+1.92ms) by Moose::Meta::Method::Constructor::_initialize_body at line 54 of Moose/Meta/Method/Constructor.pm
sub _generate_constructor_method_inline {
94314µs my $self = shift;
95
963123µs3117µs my $meta = $self->associated_metaclass;
# spent 16µs making 30 calls to Class::MOP::Method::Constructor::associated_metaclass, avg 540ns/call # spent 1µs making 1 call to Class::MOP::Method::associated_metaclass
97
9831155µs3137.1ms my @source = (
# spent 37.1ms making 31 calls to Class::MOP::Class::_inline_new_object, avg 1.20ms/call
99 'sub {',
100 $meta->_inline_new_object,
101 '}',
102 );
103
1043136µs3126µs warn join("\n", @source) if $self->options->{debug};
# spent 26µs making 31 calls to Class::MOP::Method::Constructor::options, avg 835ns/call
105
106
# spent 10.9ms (60µs+10.8) within Class::MOP::Method::Constructor::try {...} which was called 31 times, avg 351µs/call: # 31 times (60µs+10.8ms) by Try::Tiny::try at line 87 of Try/Tiny.pm, avg 351µs/call
my $code = try {
1073159µs3110.8ms $self->_compile_code(\@source);
# spent 10.8ms making 31 calls to Class::MOP::Method::Generated::_compile_code, avg 349µs/call
108 }
109 catch {
110 my $source = join("\n", @source);
111 $self->_throw_exception( CouldNotEvalConstructor => constructor_method => $self,
112 source => $source,
113 error => $_
114 );
11531206µs6211.5ms };
# spent 11.2ms making 31 calls to Try::Tiny::try, avg 362µs/call # spent 231µs making 31 calls to Try::Tiny::catch, avg 7µs/call
116
1173185µs return $code;
118}
119
12012µs1;
121
122# ABSTRACT: Method Meta Object for constructors
123
124__END__