← Index
NYTProf Performance Profile   « line view »
For ../prof.pl
  Run on Wed Dec 14 15:57:08 2022
Reported on Wed Dec 14 16:00:32 2022

Filename/Users/ether/.perlbrew/libs/36.0@std/lib/perl5/Moo/Role.pm
StatementsExecuted 1748 statements in 4.97ms
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
603331.62ms4.50msMoo::Role::::does_roleMoo::Role::does_role
3411319µs572µsMoo::Role::::_inhale_if_mooseMoo::Role::_inhale_if_moose
3442248µs847µsMoo::Role::::is_roleMoo::Role::is_role
711213µs3.61msMoo::Role::::apply_roles_to_objectMoo::Role::apply_roles_to_object
101186µs396µsMoo::Role::::_maybe_make_accessorsMoo::Role::_maybe_make_accessors
101171µs631µsMoo::Role::::_install_doesMoo::Role::_install_does
242170µs6.31msMoo::Role::::_require_moduleMoo::Role::_require_module
21160µs60µsMoo::Role::::_gen_subsMoo::Role::_gen_subs
21153µs460µsMoo::Role::::_install_subsMoo::Role::_install_subs
11151µs815µsMoo::Role::::_build_class_with_rolesMoo::Role::_build_class_with_roles
42148µs245µsMoo::Role::::_non_methodsMoo::Role::_non_methods
101138µs1.01msMoo::Role::::_undefer_subsMoo::Role::_undefer_subs
101134µs50µsMoo::Role::::role_application_stepsMoo::Role::role_application_steps
101125µs25µsMoo::Role::::_handle_constructorMoo::Role::_handle_constructor
22225µs61µsMoo::Role::::importMoo::Role::import
11116µs19µsMoo::Role::::BEGIN@2Moo::Role::BEGIN@2
21110µs342µsMoo::Role::::_install_single_modifierMoo::Role::_install_single_modifier
1119µs9µsMoo::Role::::BEGIN@19Moo::Role::BEGIN@19
2219µs15µsMoo::Role::::aroundMoo::Role::around
1119µs11µsMoo::Role::::requiresMoo::Role::requires
4118µs8µsMoo::Role::::__ANON__[:123]Moo::Role::__ANON__[:123]
3218µs8µsMoo::Role::::_maybe_reset_handlemooseMoo::Role::_maybe_reset_handlemoose
1117µs24µsMoo::Role::::BEGIN@360Moo::Role::BEGIN@360
2117µs7µsMoo::Role::::CORE:sortMoo::Role::CORE:sort (opcode)
1116µs19µsMoo::Role::::BEGIN@17Moo::Role::BEGIN@17
1115µs25µsMoo::Role::::BEGIN@3Moo::Role::BEGIN@3
1115µs54µsMoo::Role::::BEGIN@5Moo::Role::BEGIN@5
1115µs5µsMoo::Role::::_gen_apply_defaults_forMoo::Role::_gen_apply_defaults_for
1112µs2µsMoo::Role::::BEGIN@18Moo::Role::BEGIN@18
1112µs2µsMoo::Role::::BEGIN@20Moo::Role::BEGIN@20
1112µs2µsMoo::Role::::BEGIN@36Moo::Role::BEGIN@36
0000s0sMoo::Role::::__ANON__[:104]Moo::Role::__ANON__[:104]
0000s0sMoo::Role::::__ANON__[:110]Moo::Role::__ANON__[:110]
0000s0sMoo::Role::::__ANON__[:114]Moo::Role::__ANON__[:114]
0000s0sMoo::Role::::__ANON__[:225]Moo::Role::__ANON__[:225]
0000s0sMoo::Role::::__ANON__[:238]Moo::Role::__ANON__[:238]
0000s0sMoo::Role::::__ANON__[:97]Moo::Role::__ANON__[:97]
0000s0sMoo::Role::::_accessor_maker_forMoo::Role::_accessor_maker_for
0000s0sMoo::Role::::_make_accessorsMoo::Role::_make_accessors
0000s0sMoo::Role::::_make_accessors_if_mooseMoo::Role::_make_accessors_if_moose
0000s0sMoo::Role::::afterMoo::Role::after
0000s0sMoo::Role::::beforeMoo::Role::before
0000s0sMoo::Role::::hasMoo::Role::has
0000s0sMoo::Role::::metaMoo::Role::meta
0000s0sMoo::Role::::unimportMoo::Role::unimport
0000s0sMoo::Role::::withMoo::Role::with
Call graph for these subroutines as a Graphviz dot language file.
Line State
ments
Time
on line
Calls Time
in subs
Code
1package Moo::Role;
2225µs222µs
# spent 19µs (16+3) within Moo::Role::BEGIN@2 which was called: # once (16µs+3µs) by MooX::TypeTiny::import at line 2
use strict;
# spent 19µs making 1 call to Moo::Role::BEGIN@2 # spent 3µs making 1 call to strict::import
3226µs245µs
# spent 25µs (5+20) within Moo::Role::BEGIN@3 which was called: # once (5µs+20µs) by MooX::TypeTiny::import at line 3
use warnings;
# spent 25µs making 1 call to Moo::Role::BEGIN@3 # spent 20µs making 1 call to warnings::import
4
510s
# spent 54µs (5+49) within Moo::Role::BEGIN@5 which was called: # once (5µs+49µs) by MooX::TypeTiny::import at line 16
use Moo::_Utils qw(
6 _check_tracked
7 _getglob
8 _getstash
9 _install_coderef
10 _install_modifier
11 _install_tracked
12 _load_module
13 _name_coderef
14 _set_loaded
15 _unimport_coderefs
16119µs2103µs);
# spent 54µs making 1 call to Moo::Role::BEGIN@5 # spent 49µs making 1 call to Exporter::import
17211µs232µs
# spent 19µs (6+13) within Moo::Role::BEGIN@17 which was called: # once (6µs+13µs) by MooX::TypeTiny::import at line 17
use Carp qw(croak);
# spent 19µs making 1 call to Moo::Role::BEGIN@17 # spent 13µs making 1 call to Exporter::import
18220µs12µs
# spent 2µs within Moo::Role::BEGIN@18 which was called: # once (2µs+0s) by MooX::TypeTiny::import at line 18
use Role::Tiny ();
# spent 2µs making 1 call to Moo::Role::BEGIN@18
19127µs19µs
# spent 9µs within Moo::Role::BEGIN@19 which was called: # once (9µs+0s) by MooX::TypeTiny::import at line 19
BEGIN { our @ISA = qw(Role::Tiny) }
# spent 9µs making 1 call to Moo::Role::BEGIN@19
20
# spent 2µs within Moo::Role::BEGIN@20 which was called: # once (2µs+0s) by MooX::TypeTiny::import at line 28
BEGIN {
2112µs our @CARP_NOT = qw(
22 Method::Generate::Accessor
23 Method::Generate::Constructor
24 Moo::sification
25 Moo::_Utils
26 Role::Tiny
27 );
28158µs12µs}
# spent 2µs making 1 call to Moo::Role::BEGIN@20
29
3010sour $VERSION = '2.005004';
3110s$VERSION =~ tr/_//d;
32
3311µsrequire Moo::sification;
3412µs12µsMoo::sification->import;
# spent 2µs making 1 call to Moo::sification::import
35
36
# spent 2µs within Moo::Role::BEGIN@36 which was called: # once (2µs+0s) by MooX::TypeTiny::import at line 41
BEGIN {
3710s *INFO = \%Role::Tiny::INFO;
3810s *APPLIED_TO = \%Role::Tiny::APPLIED_TO;
3910s *COMPOSED = \%Role::Tiny::COMPOSED;
4012µs *ON_ROLE_CREATE = \@Role::Tiny::ON_ROLE_CREATE;
4111.28ms12µs}
# spent 2µs making 1 call to Moo::Role::BEGIN@36
42
43our %INFO;
44our %APPLIED_TO;
45our %APPLY_DEFAULTS;
46our %COMPOSED;
47our @ON_ROLE_CREATE;
48
49
# spent 61µs (25+36) within Moo::Role::import which was called 2 times, avg 31µs/call: # once (18µs+22µs) by MooX::TypeTiny::Role::GenerateAccessor::BEGIN@2 at line 2 of MooX/TypeTiny/Role/GenerateAccessor.pm # once (7µs+14µs) by JSON::Schema::Modern::Vocabulary::BEGIN@10 at line 10 of JSON/Schema/Modern/Vocabulary.pm
sub import {
5022µs my $target = caller;
5122µs if ($Moo::MAKERS{$target} and $Moo::MAKERS{$target}{is_class}) {
52 croak "Cannot import Moo::Role into a Moo class";
53 }
54210µs236µs _set_loaded(caller);
# spent 36µs making 2 calls to Moo::_Utils::_set_loaded, avg 18µs/call
55212µs2941µs goto &Role::Tiny::import;
# spent 941µs making 2 calls to Role::Tiny::import, avg 470µs/call
56}
57
58sub _accessor_maker_for {
59 my ($class, $target) = @_;
60 ($INFO{$target}{accessor_maker} ||= do {
61 require Method::Generate::Accessor;
62 Method::Generate::Accessor->new
63 });
64}
65
66
# spent 460µs (53+407) within Moo::Role::_install_subs which was called 2 times, avg 230µs/call: # 2 times (53µs+407µs) by Role::Tiny::import at line 87 of Role/Tiny.pm, avg 230µs/call
sub _install_subs {
6720s my ($me, $target) = @_;
6829µs260µs my %install = $me->_gen_subs($target);
# spent 60µs making 2 calls to Moo::Role::_gen_subs, avg 30µs/call
69 _install_tracked $target => $_ => $install{$_}
70253µs14335µs for sort keys %install;
# spent 328µs making 12 calls to Moo::_Utils::_install_tracked, avg 27µs/call # spent 7µs making 2 calls to Moo::Role::CORE:sort, avg 4µs/call
71214µs412µs *{_getglob("${target}::meta")} = $me->can('meta');
# spent 7µs making 2 calls to Moo::_Utils::_getglob, avg 4µs/call # spent 5µs making 2 calls to UNIVERSAL::can, avg 2µs/call
7226µs return;
73}
74
75
# spent 6.31ms (70µs+6.24) within Moo::Role::_require_module which was called 24 times, avg 263µs/call: # 17 times (45µs+6.09ms) by Role::Tiny::_check_roles at line 231 of Role/Tiny.pm, avg 361µs/call # 7 times (25µs+148µs) by Role::Tiny::create_class_with_roles at line 200 of Role/Tiny.pm, avg 25µs/call
sub _require_module {
7624102µs246.24ms _load_module($_[1]);
# spent 6.24ms making 24 calls to Moo::_Utils::_load_module, avg 260µs/call
77}
78
79
# spent 60µs within Moo::Role::_gen_subs which was called 2 times, avg 30µs/call: # 2 times (60µs+0s) by Moo::Role::_install_subs at line 68, avg 30µs/call
sub _gen_subs {
8021µs my ($me, $target) = @_;
81 return (
82 has => sub {
83 my $name_proto = shift;
84 my @name_proto = ref $name_proto eq 'ARRAY' ? @$name_proto : $name_proto;
85 if (@_ % 2 != 0) {
86 croak("Invalid options for " . join(', ', map "'$_'", @name_proto)
87 . " attribute(s): even number of arguments expected, got " . scalar @_)
88 }
89 my %spec = @_;
90 foreach my $name (@name_proto) {
91 my $spec_ref = @name_proto > 1 ? +{%spec} : \%spec;
92 $me->_accessor_maker_for($target)
93 ->generate_method($target, $name, $spec_ref);
94 push @{$INFO{$target}{attributes}||=[]}, $name, $spec_ref;
95 $me->_maybe_reset_handlemoose($target);
96 }
97 },
98 (map {
9962µs my $type = $_;
100 (
101
# spent 15µs (9+6) within Moo::Role::around which was called 2 times, avg 7µs/call: # once (8µs+5µs) by Moo::_Utils::_require at line 33 of MooX/TypeTiny/Role/GenerateAccessor.pm # once (1µs+1µs) by Moo::_Utils::_require at line 63 of MooX/TypeTiny/Role/GenerateAccessor.pm
$type => sub {
10223µs push @{$INFO{$target}{modifiers}||=[]}, [ $type => @_ ];
10327µs26µs $me->_maybe_reset_handlemoose($target);
# spent 6µs making 2 calls to Moo::Role::_maybe_reset_handlemoose, avg 3µs/call
104 },
105 )
106616µs } qw(before after around)),
107
# spent 11µs (9+2) within Moo::Role::requires which was called: # once (9µs+2µs) by Moo::_Utils::_require at line 24 of JSON/Schema/Modern/Vocabulary.pm
requires => sub {
10813µs push @{$INFO{$target}{requires}||=[]}, @_;
10915µs12µs $me->_maybe_reset_handlemoose($target);
# spent 2µs making 1 call to Moo::Role::_maybe_reset_handlemoose
110 },
111 with => sub {
112 $me->apply_roles_to_package($target, @_);
113 $me->_maybe_reset_handlemoose($target);
114 },
115243µs );
116}
117
118
# spent 8µs within Moo::Role::__ANON__[/Users/ether/.perlbrew/libs/36.0@std/lib/perl5/Moo/Role.pm:123] which was called 4 times, avg 2µs/call: # 4 times (8µs+0s) by Role::Tiny::make_role at line 122 of Role/Tiny.pm, avg 2µs/call
push @ON_ROLE_CREATE, sub {
11940s my $target = shift;
120418µs if ($INC{'Moo/HandleMoose.pm'} && !$Moo::sification::disabled) {
121 Moo::HandleMoose::inject_fake_metaclass_for($target);
122 }
12312µs};
124
125# duplicate from Moo::Object
126sub meta {
127 require Moo::HandleMoose::FakeMetaClass;
128 my $class = ref($_[0])||$_[0];
129 bless({ name => $class }, 'Moo::HandleMoose::FakeMetaClass');
130}
131
132sub unimport {
133 my $target = caller;
134 _unimport_coderefs($target);
135}
136
137
# spent 8µs within Moo::Role::_maybe_reset_handlemoose which was called 3 times, avg 3µs/call: # 2 times (6µs+0s) by Moo::Role::around at line 103, avg 3µs/call # once (2µs+0s) by Moo::Role::requires at line 109
sub _maybe_reset_handlemoose {
13831µs my ($class, $target) = @_;
139310µs if ($INC{'Moo/HandleMoose.pm'} && !$Moo::sification::disabled) {
140 Moo::HandleMoose::maybe_reinject_fake_metaclass_for($target);
141 }
142}
143
144
# spent 245µs (48+197) within Moo::Role::_non_methods which was called 4 times, avg 61µs/call: # 2 times (19µs+127µs) by Role::Tiny::_concrete_methods_of at line 373 of Role/Tiny.pm, avg 73µs/call # 2 times (29µs+70µs) by Role::Tiny::import at line 86 of Role/Tiny.pm, avg 50µs/call
sub _non_methods {
14543µs my $self = shift;
14640s my ($role) = @_;
147
148411µs419µs my $non_methods = $self->SUPER::_non_methods(@_);
# spent 19µs making 4 calls to Role::Tiny::_non_methods, avg 5µs/call
149
15048µs4105µs my $all_subs = $self->_all_subs($role);
# spent 105µs making 4 calls to Role::Tiny::_all_subs, avg 26µs/call
151 $non_methods->{$_} = $all_subs->{$_}
152414µs473µs for _check_tracked($role, [ keys %$all_subs ]);
# spent 73µs making 4 calls to Moo::_Utils::_check_tracked, avg 18µs/call
153
154412µs return $non_methods;
155}
156
157
# spent 847µs (248+599) within Moo::Role::is_role which was called 34 times, avg 25µs/call: # 17 times (90µs+378µs) by Role::Tiny::_check_roles at line 232 of Role/Tiny.pm, avg 28µs/call # 10 times (43µs+84µs) by Role::Tiny::_install_does at line 470 of Role/Tiny.pm, avg 13µs/call # 5 times (38µs+75µs) by MooX::HandlesVia::import at line 34 of MooX/HandlesVia.pm, avg 23µs/call # 2 times (77µs+62µs) by Role::Tiny::make_role at line 112 of Role/Tiny.pm, avg 70µs/call
sub is_role {
1583412µs my ($self, $role) = @_;
1593452µs34572µs $self->_inhale_if_moose($role);
# spent 572µs making 34 calls to Moo::Role::_inhale_if_moose, avg 17µs/call
1603485µs3427µs $self->SUPER::is_role($role);
# spent 27µs making 34 calls to Role::Tiny::is_role, avg 794ns/call
161}
162
163
# spent 572µs (319+253) within Moo::Role::_inhale_if_moose which was called 34 times, avg 17µs/call: # 34 times (319µs+253µs) by Moo::Role::is_role at line 159, avg 17µs/call
sub _inhale_if_moose {
1643415µs my ($self, $role) = @_;
165347µs my $meta;
16634407µs68253µs if (!$self->SUPER::is_role($role)
# spent 166µs making 34 calls to Role::Tiny::is_role, avg 5µs/call # spent 87µs making 34 calls to UNIVERSAL::can, avg 3µs/call
167 and (
168 $INC{"Moose.pm"}
169 and $meta = Class::MOP::class_of($role)
170 and ref $meta ne 'Moo::HandleMoose::FakeMetaClass'
171 and $meta->isa('Moose::Meta::Role')
172 )
173 or (
174 Mouse::Util->can('find_meta')
175 and $meta = Mouse::Util::find_meta($role)
176 and $meta->isa('Mouse::Meta::Role')
177 )
178 ) {
179 my $is_mouse = $meta->isa('Mouse::Meta::Role');
180 $INFO{$role}{methods} = {
181 map +($_ => $role->can($_)),
182 grep $role->can($_),
183 grep !($is_mouse && $_ eq 'meta'),
184 grep !$meta->get_method($_)->isa('Class::MOP::Method::Meta'),
185 $meta->get_method_list
186 };
187 $APPLIED_TO{$role} = {
188 map +($_->name => 1), $meta->calculate_all_roles
189 };
190 $INFO{$role}{requires} = [ $meta->get_required_method_list ];
191 $INFO{$role}{attributes} = [
192 map +($_ => do {
193 my $attr = $meta->get_attribute($_);
194 my $spec = { %{ $is_mouse ? $attr : $attr->original_options } };
195
196 if ($spec->{isa}) {
197 require Sub::Quote;
198
199 my $get_constraint = do {
200 my $pkg = $is_mouse
201 ? 'Mouse::Util::TypeConstraints'
202 : 'Moose::Util::TypeConstraints';
203 _load_module($pkg);
204 $pkg->can('find_or_create_isa_type_constraint');
205 };
206
207 my $tc = $get_constraint->($spec->{isa});
208 my $check = $tc->_compiled_type_constraint;
209 my $tc_var = '$_check_for_'.Sub::Quote::sanitize_identifier($tc->name);
210
211 $spec->{isa} = Sub::Quote::quote_sub(
212 qq{
213 &${tc_var} or Carp::croak "Type constraint failed for \$_[0]"
214 },
215 { $tc_var => \$check },
216 {
217 package => $role,
218 },
219 );
220
221 if ($spec->{coerce}) {
222
223 # Mouse has _compiled_type_coercion straight on the TC object
224 $spec->{coerce} = $tc->${\(
225 $tc->can('coercion')||sub { $_[0] }
226 )}->_compiled_type_coercion;
227 }
228 }
229 $spec;
230 }), $meta->get_attribute_list
231 ];
232 my $mods = $INFO{$role}{modifiers} = [];
233 foreach my $type (qw(before after around)) {
234 # Mouse pokes its own internals so we have to fall back to doing
235 # the same thing in the absence of the Moose API method
236 my $map = $meta->${\(
237 $meta->can("get_${type}_method_modifiers_map")
238 or sub { shift->{"${type}_method_modifiers"} }
239 )};
240 foreach my $method (keys %$map) {
241 foreach my $mod (@{$map->{$method}}) {
242 push @$mods, [ $type => $method => $mod ];
243 }
244 }
245 }
246 $INFO{$role}{inhaled_from_moose} = 1;
247 $INFO{$role}{is_role} = 1;
248 }
249}
250
251
# spent 396µs (86+310) within Moo::Role::_maybe_make_accessors which was called 10 times, avg 40µs/call: # 10 times (86µs+310µs) by Role::Tiny::apply_roles_to_package at line 312 of Role/Tiny.pm, avg 40µs/call
sub _maybe_make_accessors {
252106µs my ($self, $target, $role) = @_;
253102µs my $m;
2541070µs10310µs if ($INFO{$role} && $INFO{$role}{inhaled_from_moose}
# spent 310µs making 10 calls to Moo::_accessor_maker_for, avg 31µs/call
255 or $INC{"Moo.pm"}
256 and $m = Moo->_accessor_maker_for($target)
257 and ref($m) ne 'Method::Generate::Accessor') {
258 $self->_make_accessors($target, $role);
259 }
260}
261
262sub _make_accessors_if_moose {
263 my ($self, $target, $role) = @_;
264 if ($INFO{$role} && $INFO{$role}{inhaled_from_moose}) {
265 $self->_make_accessors($target, $role);
266 }
267}
268
269sub _make_accessors {
270 my ($self, $target, $role) = @_;
271 my $acc_gen = ($Moo::MAKERS{$target}{accessor} ||= do {
272 require Method::Generate::Accessor;
273 Method::Generate::Accessor->new
274 });
275 my $con_gen = $Moo::MAKERS{$target}{constructor};
276 my @attrs = @{$INFO{$role}{attributes}||[]};
277 while (my ($name, $spec) = splice @attrs, 0, 2) {
278 # needed to ensure we got an index for an arrayref based generator
279 if ($con_gen) {
280 $spec = $con_gen->all_attribute_specs->{$name};
281 }
282 $acc_gen->generate_method($target, $name, $spec);
283 }
284}
285
286
# spent 1.01ms (38µs+971µs) within Moo::Role::_undefer_subs which was called 10 times, avg 101µs/call: # 10 times (38µs+971µs) by Role::Tiny::apply_roles_to_package at line 312 of Role/Tiny.pm, avg 101µs/call
sub _undefer_subs {
287101µs my ($self, $target, $role) = @_;
2881039µs10971µs if ($INC{'Sub/Defer.pm'}) {
# spent 971µs making 10 calls to Sub::Defer::undefer_package, avg 97µs/call
289 Sub::Defer::undefer_package($role);
290 }
291}
292
293
# spent 50µs (34+16) within Moo::Role::role_application_steps which was called 10 times, avg 5µs/call: # 10 times (34µs+16µs) by Role::Tiny::apply_roles_to_package at line 301 of Role/Tiny.pm, avg 5µs/call
sub role_application_steps {
2941036µs1016µs qw(_handle_constructor _undefer_subs _maybe_make_accessors),
# spent 16µs making 10 calls to Role::Tiny::role_application_steps, avg 2µs/call
295 $_[0]->SUPER::role_application_steps;
296}
297
298
# spent 815µs (51+764) within Moo::Role::_build_class_with_roles which was called: # once (51µs+764µs) by Role::Tiny::create_class_with_roles at line 208 of Role/Tiny.pm
sub _build_class_with_roles {
29911µs my ($me, $new_name, $superclass, @roles) = @_;
30012µs $Moo::MAKERS{$new_name} = {is_class => 1};
30112µs1752µs $me->SUPER::_build_class_with_roles($new_name, $superclass, @roles);
# spent 752µs making 1 call to Role::Tiny::_build_class_with_roles
302
30310s if ($INC{'Moo/HandleMoose.pm'} && !$Moo::sification::disabled) {
304 Moo::HandleMoose::inject_fake_metaclass_for($new_name);
305 }
306
30710s my $lvl = 0;
30810s my $file;
309130µs while ((my $pack, $file) = caller($lvl++)) {
310411µs12µs if ($pack ne __PACKAGE__ && $pack ne 'Role::Tiny' && !$pack->isa($me)) {
# spent 2µs making 1 call to UNIVERSAL::isa
31111µs last;
312 }
313 }
31412µs110µs _set_loaded($new_name, $file || (caller)[1]);
# spent 10µs making 1 call to Moo::_Utils::_set_loaded
315
31613µs return $new_name;
317}
318
319
# spent 5µs within Moo::Role::_gen_apply_defaults_for which was called: # once (5µs+0s) by Moo::Role::apply_roles_to_object at line 380
sub _gen_apply_defaults_for {
32011µs my ($me, $class, @roles) = @_;
321
32212µs my @attrs = map @{$INFO{$_}{attributes}||[]}, @roles;
323
32410s my $con_gen;
325 my $m;
326
327 return undef
32813µs unless $INC{'Moo.pm'}
329 and @attrs
330 and $con_gen = Moo->_constructor_maker_for($class)
331 and $m = Moo->_accessor_maker_for($class);
332
333 my $specs = $con_gen->all_attribute_specs;
334
335 my %seen;
336 my %captures;
337 my @set;
338 while (my ($name, $spec) = splice @attrs, 0, 2) {
339 next
340 if $seen{$name}++;
341
342 next
343 unless $m->has_eager_default($name, $spec);
344
345 my ($has, $has_cap)
346 = $m->generate_simple_has('$_[0]', $name, $spec);
347 my ($set, $pop_cap)
348 = $m->generate_use_default('$_[0]', $name, $spec, $has);
349
350 @captures{keys %$has_cap, keys %$pop_cap}
351 = (values %$has_cap, values %$pop_cap);
352
353 push @set, $set;
354 }
355
356 return undef
357 if !@set;
358
359 my $code = join '', map "($_),", @set;
3602409µs241µs
# spent 24µs (7+17) within Moo::Role::BEGIN@360 which was called: # once (7µs+17µs) by MooX::TypeTiny::import at line 360
no warnings 'void';
# spent 24µs making 1 call to Moo::Role::BEGIN@360 # spent 17µs making 1 call to warnings::unimport
361 require Sub::Quote;
362 return Sub::Quote::quote_sub(
363 "${class}::_apply_defaults",
364 $code,
365 \%captures,
366 {
367 package => $class,
368 no_install => 1,
369 no_defer => 1,
370 }
371 );
372}
373
374
# spent 3.61ms (213µs+3.39) within Moo::Role::apply_roles_to_object which was called 7 times, avg 515µs/call: # 7 times (213µs+3.39ms) by MooX::TypeTiny::__ANON__[/Users/ether/.perlbrew/libs/36.0@std/lib/perl5/MooX/TypeTiny.pm:25] at line 21 of MooX/TypeTiny.pm, avg 515µs/call
sub apply_roles_to_object {
37575µs my ($me, $object, @roles) = @_;
376726µs73.31ms my $new = $me->SUPER::apply_roles_to_object($object, @roles);
# spent 3.31ms making 7 calls to Role::Tiny::apply_roles_to_object, avg 473µs/call
37777µs my $class = ref $new;
378749µs779µs _set_loaded($class, (caller)[1]);
# spent 79µs making 7 calls to Moo::_Utils::_set_loaded, avg 11µs/call
379
380713µs15µs if (!exists $APPLY_DEFAULTS{$class}) {
# spent 5µs making 1 call to Moo::Role::_gen_apply_defaults_for
381 $APPLY_DEFAULTS{$class} = $me->_gen_apply_defaults_for($class, @roles);
382 }
38374µs if (my $apply_defaults = $APPLY_DEFAULTS{$class}) {
384 local $Carp::Internal{+__PACKAGE__} = 1;
385 local $Carp::Internal{$class} = 1;
386 $new->$apply_defaults;
387 }
388716µs return $new;
389}
390
391
# spent 342µs (10+332) within Moo::Role::_install_single_modifier which was called 2 times, avg 171µs/call: # 2 times (10µs+332µs) by Role::Tiny::_install_modifiers at line 444 of Role/Tiny.pm, avg 171µs/call
sub _install_single_modifier {
39222µs my ($me, @args) = @_;
39327µs2332µs _install_modifier(@args);
# spent 332µs making 2 calls to Moo::_Utils::_install_modifier, avg 166µs/call
394}
395
396
# spent 631µs (71+560) within Moo::Role::_install_does which was called 10 times, avg 63µs/call: # 10 times (71µs+560µs) by Role::Tiny::_install_methods at line 428 of Role/Tiny.pm, avg 63µs/call
sub _install_does {
397106µs my ($me, $to) = @_;
398
399 # If Role::Tiny actually installed the DOES, give it a name
4001028µs10448µs my $new = $me->SUPER::_install_does($to) or return;
# spent 448µs making 10 calls to Role::Tiny::_install_does, avg 45µs/call
4011040µs10112µs return _name_coderef("${to}::DOES", $new);
# spent 112µs making 10 calls to Moo::_Utils::_name_coderef, avg 11µs/call
402}
403
404
# spent 4.50ms (1.62+2.88) within Moo::Role::does_role which was called 603 times, avg 7µs/call: # 556 times (1.38ms+2.43ms) by JSON::Schema::Modern::Vocabulary::Applicator::DOES or JSON::Schema::Modern::Vocabulary::Content::DOES or JSON::Schema::Modern::Vocabulary::Core::DOES or JSON::Schema::Modern::Vocabulary::FormatAnnotation::DOES or JSON::Schema::Modern::Vocabulary::FormatAssertion::DOES or JSON::Schema::Modern::Vocabulary::MetaData::DOES or JSON::Schema::Modern::Vocabulary::OpenAPI::DOES or JSON::Schema::Modern::Vocabulary::Unevaluated::DOES or JSON::Schema::Modern::Vocabulary::Validation::DOES at line 482 of Role/Tiny.pm, avg 7µs/call # 46 times (235µs+437µs) by MooX::TypeTiny::__ANON__[/Users/ether/.perlbrew/libs/36.0@std/lib/perl5/MooX/TypeTiny.pm:25] at line 21 of MooX/TypeTiny.pm, avg 15µs/call # once (7µs+16µs) by MooX::TypeTiny::__ANON__[/Users/ether/.perlbrew/libs/36.0@std/lib/perl5/MooX/TypeTiny.pm:25] at line 68 of Moo/Object.pm
sub does_role {
405603124µs my ($proto, $role) = @_;
4066031.54ms6032.88ms return 1
# spent 2.88ms making 603 calls to Role::Tiny::does_role, avg 5µs/call
407 if Role::Tiny::does_role($proto, $role);
40872µs my $meta;
40975µs if ($INC{'Moose.pm'}
410 and $meta = Class::MOP::class_of($proto)
411 and ref $meta ne 'Moo::HandleMoose::FakeMetaClass'
412 and $meta->can('does_role')
413 ) {
414 return $meta->does_role($role);
415 }
416719µs return 0;
417}
418
419
# spent 25µs within Moo::Role::_handle_constructor which was called 10 times, avg 2µs/call: # 10 times (25µs+0s) by Role::Tiny::apply_roles_to_package at line 312 of Role/Tiny.pm, avg 2µs/call
sub _handle_constructor {
420105µs my ($me, $to, $role) = @_;
421109µs my $attr_info = $INFO{$role} && $INFO{$role}{attributes};
4221014µs return unless $attr_info && @$attr_info;
423 my $info = $INFO{$to};
424 my $con = $INC{"Moo.pm"} && Moo->_constructor_maker_for($to);
425 my %existing
426 = $info ? @{$info->{attributes} || []}
427 : $con ? %{$con->all_attribute_specs || {}}
428 : ();
429
430 my @attr_info =
431 map { @{$attr_info}[$_, $_+1] }
432 grep { ! $existing{$attr_info->[$_]} }
433 map { 2 * $_ } 0..@$attr_info/2-1;
434
435 if ($info) {
436 push @{$info->{attributes}||=[]}, @attr_info;
437 }
438 elsif ($con) {
439 # shallow copy of the specs since the constructor will assign an index
440 $con->register_attribute_specs(map ref() ? { %$_ } : $_, @attr_info);
441 }
442}
443
44415µs1;
445__END__
 
# spent 7µs within Moo::Role::CORE:sort which was called 2 times, avg 4µs/call: # 2 times (7µs+0s) by Moo::Role::_install_subs at line 70, avg 4µs/call
sub Moo::Role::CORE:sort; # opcode