← Index
NYTProf Performance Profile   « line view »
For flows_to_es.pl
  Run on Mon May 9 23:27:59 2016
Reported on Mon May 9 23:28:08 2016

Filename/usr/share/perl5/Moo.pm
StatementsExecuted 881 statements in 5.29ms
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
34324.65ms7.11msMoo::::_accessor_maker_forMoo::_accessor_maker_for
1112.32ms3.77msMoo::::BEGIN@5Moo::BEGIN@5
1111112.29ms5.28msMoo::::importMoo::import
1111.90ms6.21msMoo::::BEGIN@4Moo::BEGIN@4
16331.80ms12.7msMoo::::_constructor_maker_forMoo::_constructor_maker_for (recurses: max depth 1, inclusive time 7.03ms)
111660µs807µsMoo::::BEGIN@3Moo::BEGIN@3
111660µs964µsMoo::::BEGIN@6Moo::BEGIN@6
111411µs459µsMoo::::BEGIN@7Moo::BEGIN@7
6641280µs1.06msMoo::::_install_trackedMoo::_install_tracked
162132µs32µsMoo::::_maybe_reset_handlemooseMoo::_maybe_reset_handlemoose
11111µs22µsMoo::::BEGIN@110Moo::BEGIN@110
1118µs21µsMoo::::BEGIN@75Moo::BEGIN@75
0000s0sMoo::::__ANON__[:187]Moo::__ANON__[:187]
0000s0sMoo::::__ANON__[:35]Moo::__ANON__[:35]
0000s0sMoo::::__ANON__[:40]Moo::__ANON__[:40]
0000s0sMoo::::__ANON__[:61]Moo::__ANON__[:61]
0000s0sMoo::::__ANON__[:67]Moo::__ANON__[:67]
0000s0sMoo::::_concrete_methods_ofMoo::_concrete_methods_of
0000s0sMoo::::_set_superclassesMoo::_set_superclasses
0000s0sMoo::::unimportMoo::unimport
Call graph for these subroutines as a Graphviz dot language file.
Line State
ments
Time
on line
Calls Time
in subs
Code
1package Moo;
2
33114µs3866µs
# spent 807µs (660+147) within Moo::BEGIN@3 which was called: # once (660µs+147µs) by Search::Elasticsearch::BEGIN@3 at line 3
use strictures 1;
# spent 807µs making 1 call to Moo::BEGIN@3 # spent 40µs making 1 call to strictures::import # spent 19µs making 1 call to strictures::VERSION
42119µs26.27ms
# spent 6.21ms (1.90+4.31) within Moo::BEGIN@4 which was called: # once (1.90ms+4.31ms) by Search::Elasticsearch::BEGIN@3 at line 4
use Moo::_Utils;
# spent 6.21ms making 1 call to Moo::BEGIN@4 # spent 64µs making 1 call to Exporter::import
52125µs24.45ms
# spent 3.77ms (2.32+1.46) within Moo::BEGIN@5 which was called: # once (2.32ms+1.46ms) by Search::Elasticsearch::BEGIN@3 at line 5
use B 'perlstring';
# spent 3.77ms making 1 call to Moo::BEGIN@5 # spent 677µs making 1 call to Exporter::import
62114µs1964µs
# spent 964µs (660+304) within Moo::BEGIN@6 which was called: # once (660µs+304µs) by Search::Elasticsearch::BEGIN@3 at line 6
use Sub::Defer ();
# spent 964µs making 1 call to Moo::BEGIN@6
72639µs1459µs
# spent 459µs (411+48) within Moo::BEGIN@7 which was called: # once (411µs+48µs) by Search::Elasticsearch::BEGIN@3 at line 7
use Import::Into;
# spent 459µs making 1 call to Moo::BEGIN@7
8
91700nsour $VERSION = '1.004002';
10113µs$VERSION = eval $VERSION;
# spent 2µs executing statements in string eval
11
12179µsrequire Moo::sification;
13
141200nsour %MAKERS;
15
16
# spent 1.06ms (280µs+782µs) within Moo::_install_tracked which was called 66 times, avg 16µs/call: # 33 times (121µs+363µs) by Moo::import at line 67, avg 15µs/call # 11 times (73µs+187µs) by Moo::import at line 35, avg 24µs/call # 11 times (44µs+119µs) by Moo::import at line 40, avg 15µs/call # 11 times (41µs+113µs) by Moo::import at line 61, avg 14µs/call
sub _install_tracked {
176631µs my ($target, $name, $code) = @_;
186662µs $MAKERS{$target}{exports}{$name} = $code;
1966181µs66782µs _install_coderef "${target}::${name}" => "Moo::${name}" => $code;
# spent 782µs making 66 calls to Moo::_Utils::_install_coderef, avg 12µs/call
20}
21
22
# spent 5.28ms (2.29+2.99) within Moo::import which was called 11 times, avg 480µs/call: # once (924µs+246µs) by Search::Elasticsearch::Cxn::Factory::BEGIN@3 at line 3 of /opt/flows/lib/lib/perl5/Search/Elasticsearch/Cxn/Factory.pm # once (734µs+396µs) by Search::Elasticsearch::Util::BEGIN@3 at line 3 of /opt/flows/lib/lib/perl5/Search/Elasticsearch/Util.pm # once (103µs+348µs) by Search::Elasticsearch::Serializer::JSON::BEGIN@3 at line 3 of /opt/flows/lib/lib/perl5/Search/Elasticsearch/Serializer/JSON.pm # once (74µs+259µs) by Search::Elasticsearch::Bulk::BEGIN@3 at line 3 of /opt/flows/lib/lib/perl5/Search/Elasticsearch/Bulk.pm # once (77µs+253µs) by Method::Generate::Constructor::BEGIN@197 at line 197 of Method/Generate/Constructor.pm # once (68µs+248µs) by Search::Elasticsearch::Client::2_0::Direct::BEGIN@5 at line 5 of /opt/flows/lib/lib/perl5/Search/Elasticsearch/Client/2_0/Direct.pm # once (64µs+249µs) by Search::Elasticsearch::CxnPool::Static::BEGIN@3 at line 3 of /opt/flows/lib/lib/perl5/Search/Elasticsearch/CxnPool/Static.pm # once (60µs+249µs) by Search::Elasticsearch::Cxn::HTTPTiny::BEGIN@3 at line 3 of /opt/flows/lib/lib/perl5/Search/Elasticsearch/Cxn/HTTPTiny.pm # once (61µs+248µs) by Search::Elasticsearch::Transport::BEGIN@3 at line 3 of /opt/flows/lib/lib/perl5/Search/Elasticsearch/Transport.pm # once (63µs+245µs) by Search::Elasticsearch::Client::2_0::Direct::Indices::BEGIN@3 at line 3 of /opt/flows/lib/lib/perl5/Search/Elasticsearch/Client/2_0/Direct/Indices.pm # once (60µs+247µs) by Search::Elasticsearch::Logger::LogAny::BEGIN@3 at line 3 of /opt/flows/lib/lib/perl5/Search/Elasticsearch/Logger/LogAny.pm
sub import {
231112µs my $target = caller;
24115µs my $class = shift;
251123µs11373µs _set_loaded(caller);
# spent 373µs making 11 calls to Moo::_Utils::_set_loaded, avg 34µs/call
261175µs111.44ms strictures->import::into(1);
# spent 1.44ms making 11 calls to import::into, avg 131µs/call
27116µs if ($Role::Tiny::INFO{$target} and $Role::Tiny::INFO{$target}{is_role}) {
28 die "Cannot import Moo into a role";
29 }
301114µs $MAKERS{$target} ||= {};
31 _install_tracked $target => extends => sub {
32 $class->_set_superclasses($target, @_);
33 $class->_maybe_reset_handlemoose($target);
34 return;
351140µs11260µs };
# spent 260µs making 11 calls to Moo::_install_tracked, avg 24µs/call
36 _install_tracked $target => with => sub {
371196µs require Moo::Role;
381124µs1175.2ms Moo::Role->apply_roles_to_package($target, @_);
# spent 75.2ms making 11 calls to Moo::Role::apply_roles_to_package, avg 6.84ms/call
391152µs1118µs $class->_maybe_reset_handlemoose($target);
# spent 18µs making 11 calls to Moo::_maybe_reset_handlemoose, avg 2µs/call
401133µs11163µs };
# spent 163µs making 11 calls to Moo::_install_tracked, avg 15µs/call
41 _install_tracked $target => has => sub {
4252µs my $name_proto = shift;
4355µs my @name_proto = ref $name_proto eq 'ARRAY' ? @$name_proto : $name_proto;
4454µs if (@_ % 2 != 0) {
45 require Carp;
46 Carp::croak("Invalid options for " . join(', ', map "'$_'", @name_proto)
47 . " attribute(s): even number of arguments expected, got " . scalar @_)
48 }
4959µs my %spec = @_;
5053µs foreach my $name (@name_proto) {
51 # Note that when multiple attributes specified, each attribute
52 # needs a separate \%specs hashref
5354µs my $spec_ref = @name_proto > 1 ? +{%spec} : \%spec;
54517µs1012.0ms $class->_constructor_maker_for($target)
# spent 12.0ms making 5 calls to Moo::_constructor_maker_for, avg 2.40ms/call # spent 44µs making 5 calls to Method::Generate::Constructor::register_attribute_specs, avg 9µs/call
55 ->register_attribute_specs($name, $spec_ref);
56514µs105.69ms $class->_accessor_maker_for($target)
# spent 5.68ms making 5 calls to Method::Generate::Accessor::generate_method, avg 1.14ms/call # spent 11µs making 5 calls to Moo::_accessor_maker_for, avg 2µs/call
57 ->generate_method($target, $name, $spec_ref);
58517µs514µs $class->_maybe_reset_handlemoose($target);
# spent 14µs making 5 calls to Moo::_maybe_reset_handlemoose, avg 3µs/call
59 }
60518µs return;
611144µs11154µs };
# spent 154µs making 11 calls to Moo::_install_tracked, avg 14µs/call
621110µs foreach my $type (qw(before after around)) {
63 _install_tracked $target => $type => sub {
64 require Class::Method::Modifiers;
65 _install_modifier($target, $type, @_);
66 return;
6733110µs33485µs };
# spent 485µs making 33 calls to Moo::_install_tracked, avg 15µs/call
68 }
69116µs return if $MAKERS{$target}{is_class}; # already exported into this package
701114µs1123µs my $stash = _getstash($target);
# spent 23µs making 11 calls to Moo::_Utils::_getstash, avg 2µs/call
711179µs my @not_methods = map { *$_{CODE}||() } grep !ref($_), values %$stash;
7211926µs @{$MAKERS{$target}{not_methods}={}}{@not_methods} = @not_methods;
73118µs $MAKERS{$target}{is_class} = 1;
74 {
7513313µs234µs
# spent 21µs (8+13) within Moo::BEGIN@75 which was called: # once (8µs+13µs) by Search::Elasticsearch::BEGIN@3 at line 75
no strict 'refs';
# spent 21µs making 1 call to Moo::BEGIN@75 # spent 13µs making 1 call to strict::unimport
76 @{"${target}::ISA"} = do {
772094µs require Moo::Object; ('Moo::Object');
7811112µs } unless @{"${target}::ISA"};
79 }
801162µs if ($INC{'Moo/HandleMoose.pm'}) {
81 Moo::HandleMoose::inject_fake_metaclass_for($target);
82 }
83}
84
85sub unimport {
86 my $target = caller;
87 _unimport_coderefs($target, $MAKERS{$target});
88}
89
90sub _set_superclasses {
91 my $class = shift;
92 my $target = shift;
93 foreach my $superclass (@_) {
94 _load_module($superclass);
95 if ($INC{"Role/Tiny.pm"} && $Role::Tiny::INFO{$superclass}) {
96 require Carp;
97 Carp::croak("Can't extend role '$superclass'");
98 }
99 }
100 # Can't do *{...} = \@_ or 5.10.0's mro.pm stops seeing @ISA
101 @{*{_getglob("${target}::ISA")}{ARRAY}} = @_;
102 if (my $old = delete $Moo::MAKERS{$target}{constructor}) {
103 delete _getstash($target)->{new};
104 Moo->_constructor_maker_for($target)
105 ->register_attribute_specs(%{$old->all_attribute_specs});
106 }
107 elsif (!$target->isa('Moo::Object')) {
108 Moo->_constructor_maker_for($target);
109 }
1102743µs233µs
# spent 22µs (11+11) within Moo::BEGIN@110 which was called: # once (11µs+11µs) by Search::Elasticsearch::BEGIN@3 at line 110
no warnings 'once'; # piss off. -- mst
# spent 22µs making 1 call to Moo::BEGIN@110 # spent 11µs making 1 call to warnings::unimport
111 $Moo::HandleMoose::MOUSE{$target} = [
112 grep defined, map Mouse::Util::find_meta($_), @_
113 ] if Mouse::Util->can('find_meta');
114}
115
116
# spent 32µs within Moo::_maybe_reset_handlemoose which was called 16 times, avg 2µs/call: # 11 times (18µs+0s) by Moo::with at line 39, avg 2µs/call # 5 times (14µs+0s) by Moo::has at line 58, avg 3µs/call
sub _maybe_reset_handlemoose {
117168µs my ($class, $target) = @_;
1181634µs if ($INC{"Moo/HandleMoose.pm"}) {
119 Moo::HandleMoose::maybe_reinject_fake_metaclass_for($target);
120 }
121}
122
123
# spent 7.11ms (4.65+2.46) within Moo::_accessor_maker_for which was called 34 times, avg 209µs/call: # 19 times (64µs+17µs) by Moo::Role::_maybe_make_accessors at line 198 of Moo/Role.pm, avg 4µs/call # 10 times (4.58ms+2.45ms) by Moo::_constructor_maker_for at line 199, avg 702µs/call # 5 times (11µs+0s) by Moo::has at line 56, avg 2µs/call
sub _accessor_maker_for {
1243411µs my ($class, $target) = @_;
1253418µs return unless $MAKERS{$target};
1263179µs $MAKERS{$target}{accessor} ||= do {
127107µs my $maker_class = do {
128105µs if (my $m = do {
1291067µs2037µs if (my $defer_target =
# spent 22µs making 10 calls to Sub::Defer::defer_info, avg 2µs/call # spent 15µs making 10 calls to UNIVERSAL::can, avg 1µs/call
130 (Sub::Defer::defer_info($target->can('new'))||[])->[0]
131 ) {
132 my ($pkg) = ($defer_target =~ /^(.*)::[^:]+$/);
133 $MAKERS{$pkg} && $MAKERS{$pkg}{accessor};
134 } else {
135103µs undef;
136 }
137 }) {
138 ref($m);
139 } else {
14010100µs require Method::Generate::Accessor;
141102µs 'Method::Generate::Accessor'
142 }
143 };
1441028µs1066µs $maker_class->new;
# spent 66µs making 10 calls to Moo::Object::new, avg 7µs/call
145 }
146}
147
148
# spent 12.7ms (1.80+10.9) within Moo::_constructor_maker_for which was called 16 times, avg 793µs/call: # 10 times (199µs+488µs) by Moo::Role::_handle_constructor at line 351 of Moo/Role.pm, avg 69µs/call # 5 times (1.54ms+10.5ms) by Moo::has at line 54, avg 2.40ms/call # once (59µs+-59µs) by Moo::_constructor_maker_for at line 198 of Method/Generate/Constructor.pm
sub _constructor_maker_for {
149168µs my ($class, $target, $select_super) = @_;
150167µs return unless $MAKERS{$target};
1511650µs $MAKERS{$target}{constructor} ||= do {
1521096µs require Method::Generate::Constructor;
153103µs require Sub::Defer;
154101µs my ($moo_constructor, $con);
155
156105µs if ($select_super && $MAKERS{$select_super}) {
157 $moo_constructor = 1;
158 $con = $MAKERS{$select_super}{constructor};
159 } else {
1601087µs1024µs my $t_new = $target->can('new');
# spent 24µs making 10 calls to UNIVERSAL::can, avg 2µs/call
161105µs if ($t_new) {
1621046µs1010µs if ($t_new == Moo::Object->can('new')) {
# spent 10µs making 10 calls to UNIVERSAL::can, avg 950ns/call
163 $moo_constructor = 1;
164 } elsif (my $defer_target = (Sub::Defer::defer_info($t_new)||[])->[0]) {
165 my ($pkg) = ($defer_target =~ /^(.*)::[^:]+$/);
166 if ($MAKERS{$pkg}) {
167 $moo_constructor = 1;
168 $con = $MAKERS{$pkg}{constructor};
169 }
170 }
171 } else {
172 $moo_constructor = 1; # no other constructor, make a Moo one
173 }
174 }
175 ($con ? ref($con) : 'Method::Generate::Constructor')
176 ->new(
177 package => $target,
178 accessor_generator => $class->_accessor_maker_for($target),
179 $moo_constructor ? (
180 $con ? (construction_string => $con->construction_string) : ()
181 ) : (
182 construction_builder => sub {
183 '$class->'.$target.'::SUPER::new('
184 .($target->can('FOREIGNBUILDARGS') ?
185 '$class->FOREIGNBUILDARGS(@_)' : '@_')
186 .')'
187 },
188 ),
189 subconstructor_handler => (
190 ' if ($Moo::MAKERS{$class}) {'."\n"
191 .' '.$class.'->_constructor_maker_for($class,'.perlstring($target).');'."\n"
192 .' return $class->new(@_)'.";\n"
193 .' } elsif ($INC{"Moose.pm"} and my $meta = Class::MOP::get_metaclass_by_name($class)) {'."\n"
194 .' return $meta->new_object($class->BUILDARGS(@_));'."\n"
195 .' }'."\n"
196 ),
197 )
198 ->install_delayed
19910148µs508.57ms ->register_attribute_specs(%{$con?$con->all_attribute_specs:{}})
# spent 7.02ms making 10 calls to Moo::_accessor_maker_for, avg 702µs/call # spent 1.12ms making 9 calls to Method::Generate::Constructor::new, avg 124µs/call # spent 343µs making 10 calls to Method::Generate::Constructor::install_delayed, avg 34µs/call # spent 44µs making 10 calls to Method::Generate::Constructor::register_attribute_specs, avg 4µs/call # spent 30µs making 10 calls to B::perlstring, avg 3µs/call # spent 17µs making 1 call to Moo::Object::new
200 }
201}
202
203sub _concrete_methods_of {
204 my ($me, $role) = @_;
205 my $makers = $MAKERS{$role};
206 # grab role symbol table
207 my $stash = _getstash($role);
208 # reverse so our keys become the values (captured coderefs) in case
209 # they got copied or re-used since
210 my $not_methods = { reverse %{$makers->{not_methods}||{}} };
211 +{
212 # grab all code entries that aren't in the not_methods list
213 map {
214 my $code = *{$stash->{$_}}{CODE};
215 ( ! $code or exists $not_methods->{$code} ) ? () : ($_ => $code)
216 } grep !ref($stash->{$_}), keys %$stash
217 };
218}
219
22013µs1;
221__END__