← Index
NYTProf Performance Profile   « line view »
For ../prof.pl
  Run on Wed Dec 14 16:10:05 2022
Reported on Wed Dec 14 16:12:57 2022

Filename/Users/ether/.perlbrew/libs/36.0@std/lib/perl5/Moo/Role.pm
StatementsExecuted 1748 statements in 6.04ms
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
603331.44ms3.88msMoo::Role::::does_roleMoo::Role::does_role
3411298µs437µsMoo::Role::::_inhale_if_mooseMoo::Role::_inhale_if_moose
3442236µs703µsMoo::Role::::is_roleMoo::Role::is_role
711134µs4.74msMoo::Role::::apply_roles_to_objectMoo::Role::apply_roles_to_object
101175µs766µsMoo::Role::::_install_doesMoo::Role::_install_does
21172µs339µsMoo::Role::::_install_subsMoo::Role::_install_subs
42168µs364µsMoo::Role::::_non_methodsMoo::Role::_non_methods
242166µs7.51msMoo::Role::::_require_moduleMoo::Role::_require_module
101164µs385µsMoo::Role::::_maybe_make_accessorsMoo::Role::_maybe_make_accessors
101157µs57µsMoo::Role::::_handle_constructorMoo::Role::_handle_constructor
11145µs49µsMoo::Role::::BEGIN@2Moo::Role::BEGIN@2
11143µs1.75msMoo::Role::::_build_class_with_rolesMoo::Role::_build_class_with_roles
101141µs57µsMoo::Role::::role_application_stepsMoo::Role::role_application_steps
11139µs42µsMoo::Role::::requiresMoo::Role::requires
101136µs715µsMoo::Role::::_undefer_subsMoo::Role::_undefer_subs
21130µs30µsMoo::Role::::_gen_subsMoo::Role::_gen_subs
21127µs849µsMoo::Role::::_install_single_modifierMoo::Role::_install_single_modifier
22227µs52µsMoo::Role::::importMoo::Role::import
22117µs24µsMoo::Role::::aroundMoo::Role::around
11114µs66µsMoo::Role::::BEGIN@360Moo::Role::BEGIN@360
11112µs12µsMoo::Role::::BEGIN@19Moo::Role::BEGIN@19
41110µs10µsMoo::Role::::__ANON__[:123]Moo::Role::__ANON__[:123]
32110µs10µsMoo::Role::::_maybe_reset_handlemooseMoo::Role::_maybe_reset_handlemoose
1119µs9µsMoo::Role::::_gen_apply_defaults_forMoo::Role::_gen_apply_defaults_for
1118µs76µsMoo::Role::::BEGIN@5Moo::Role::BEGIN@5
1117µs28µsMoo::Role::::BEGIN@17Moo::Role::BEGIN@17
1116µs51µsMoo::Role::::BEGIN@3Moo::Role::BEGIN@3
2115µs5µsMoo::Role::::CORE:sortMoo::Role::CORE:sort (opcode)
1114µs4µsMoo::Role::::BEGIN@18Moo::Role::BEGIN@18
1113µs3µsMoo::Role::::BEGIN@20Moo::Role::BEGIN@20
1113µs3µ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;
2238µs253µs
# spent 49µs (45+4) within Moo::Role::BEGIN@2 which was called: # once (45µs+4µs) by MooX::TypeTiny::import at line 2
use strict;
# spent 49µs making 1 call to Moo::Role::BEGIN@2 # spent 4µs making 1 call to strict::import
3238µs296µs
# spent 51µs (6+45) within Moo::Role::BEGIN@3 which was called: # once (6µs+45µs) by MooX::TypeTiny::import at line 3
use warnings;
# spent 51µs making 1 call to Moo::Role::BEGIN@3 # spent 45µs making 1 call to warnings::import
4
511µs
# spent 76µs (8+68) within Moo::Role::BEGIN@5 which was called: # once (8µs+68µ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
16124µs2144µs);
# spent 76µs making 1 call to Moo::Role::BEGIN@5 # spent 68µs making 1 call to Exporter::import
17225µs249µs
# spent 28µs (7+21) within Moo::Role::BEGIN@17 which was called: # once (7µs+21µs) by MooX::TypeTiny::import at line 17
use Carp qw(croak);
# spent 28µs making 1 call to Moo::Role::BEGIN@17 # spent 21µs making 1 call to Exporter::import
18231µs14µs
# spent 4µs within Moo::Role::BEGIN@18 which was called: # once (4µs+0s) by MooX::TypeTiny::import at line 18
use Role::Tiny ();
# spent 4µs making 1 call to Moo::Role::BEGIN@18
19142µs112µs
# spent 12µs within Moo::Role::BEGIN@19 which was called: # once (12µs+0s) by MooX::TypeTiny::import at line 19
BEGIN { our @ISA = qw(Role::Tiny) }
# spent 12µs making 1 call to Moo::Role::BEGIN@19
20
# spent 3µs within Moo::Role::BEGIN@20 which was called: # once (3µs+0s) by MooX::TypeTiny::import at line 28
BEGIN {
2114µs our @CARP_NOT = qw(
22 Method::Generate::Accessor
23 Method::Generate::Constructor
24 Moo::sification
25 Moo::_Utils
26 Role::Tiny
27 );
28174µs13µs}
# spent 3µs making 1 call to Moo::Role::BEGIN@20
29
3010sour $VERSION = '2.005004';
3111µs$VERSION =~ tr/_//d;
32
3311µsrequire Moo::sification;
3414µs19µsMoo::sification->import;
# spent 9µs making 1 call to Moo::sification::import
35
36
# spent 3µs within Moo::Role::BEGIN@36 which was called: # once (3µs+0s) by MooX::TypeTiny::import at line 41
BEGIN {
3711µs *INFO = \%Role::Tiny::INFO;
3810s *APPLIED_TO = \%Role::Tiny::APPLIED_TO;
3910s *COMPOSED = \%Role::Tiny::COMPOSED;
4016µs *ON_ROLE_CREATE = \@Role::Tiny::ON_ROLE_CREATE;
4112.11ms13µs}
# spent 3µ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 52µs (27+25) within Moo::Role::import which was called 2 times, avg 26µs/call: # once (17µs+14µs) by MooX::TypeTiny::Role::GenerateAccessor::BEGIN@2 at line 2 of MooX/TypeTiny/Role/GenerateAccessor.pm # once (10µs+11µ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 }
5427µs225µs _set_loaded(caller);
# spent 25µs making 2 calls to Moo::_Utils::_set_loaded, avg 12µs/call
55213µs2828µs goto &Role::Tiny::import;
# spent 828µs making 2 calls to Role::Tiny::import, avg 414µ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 339µs (72+267) within Moo::Role::_install_subs which was called 2 times, avg 170µs/call: # 2 times (72µs+267µs) by Role::Tiny::import at line 87 of Role/Tiny.pm, avg 170µs/call
sub _install_subs {
6721µs my ($me, $target) = @_;
68210µs230µs my %install = $me->_gen_subs($target);
# spent 30µs making 2 calls to Moo::Role::_gen_subs, avg 15µs/call
69 _install_tracked $target => $_ => $install{$_}
70236µs14227µs for sort keys %install;
# spent 222µs making 12 calls to Moo::_Utils::_install_tracked, avg 18µs/call # spent 5µs making 2 calls to Moo::Role::CORE:sort, avg 2µs/call
71218µs410µs *{_getglob("${target}::meta")} = $me->can('meta');
# spent 5µs making 2 calls to Moo::_Utils::_getglob, avg 2µs/call # spent 5µs making 2 calls to UNIVERSAL::can, avg 2µs/call
7227µs return;
73}
74
75
# spent 7.51ms (66µs+7.44) within Moo::Role::_require_module which was called 24 times, avg 313µs/call: # 17 times (41µs+7.31ms) by Role::Tiny::_check_roles at line 231 of Role/Tiny.pm, avg 433µs/call # 7 times (25µs+128µs) by Role::Tiny::create_class_with_roles at line 200 of Role/Tiny.pm, avg 22µs/call
sub _require_module {
762480µs247.44ms _load_module($_[1]);
# spent 7.44ms making 24 calls to Moo::_Utils::_load_module, avg 310µs/call
77}
78
79
# spent 30µs within Moo::Role::_gen_subs which was called 2 times, avg 15µs/call: # 2 times (30µs+0s) by Moo::Role::_install_subs at line 68, avg 15µs/call
sub _gen_subs {
8022µ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 {
9961µs my $type = $_;
100 (
101
# spent 24µs (17+7) within Moo::Role::around which was called 2 times, avg 12µs/call: # once (13µs+6µs) by Moo::_Utils::_require at line 33 of MooX/TypeTiny/Role/GenerateAccessor.pm # once (4µs+1µs) by Moo::_Utils::_require at line 63 of MooX/TypeTiny/Role/GenerateAccessor.pm
$type => sub {
10226µs push @{$INFO{$target}{modifiers}||=[]}, [ $type => @_ ];
103210µs27µs $me->_maybe_reset_handlemoose($target);
# spent 7µs making 2 calls to Moo::Role::_maybe_reset_handlemoose, avg 4µs/call
104 },
105 )
10668µs } qw(before after around)),
107
# spent 42µs (39+3) within Moo::Role::requires which was called: # once (39µs+3µs) by Moo::_Utils::_require at line 24 of JSON/Schema/Modern/Vocabulary.pm
requires => sub {
10812µs push @{$INFO{$target}{requires}||=[]}, @_;
10915µs13µs $me->_maybe_reset_handlemoose($target);
# spent 3µ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 },
115222µs );
116}
117
118
# spent 10µ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 (10µ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;
120413µs if ($INC{'Moo/HandleMoose.pm'} && !$Moo::sification::disabled) {
121 Moo::HandleMoose::inject_fake_metaclass_for($target);
122 }
12315µ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 10µs within Moo::Role::_maybe_reset_handlemoose which was called 3 times, avg 3µs/call: # 2 times (7µs+0s) by Moo::Role::around at line 103, avg 4µs/call # once (3µs+0s) by Moo::Role::requires at line 109
sub _maybe_reset_handlemoose {
13833µs my ($class, $target) = @_;
139343µs if ($INC{'Moo/HandleMoose.pm'} && !$Moo::sification::disabled) {
140 Moo::HandleMoose::maybe_reinject_fake_metaclass_for($target);
141 }
142}
143
144
# spent 364µs (68+296) within Moo::Role::_non_methods which was called 4 times, avg 91µs/call: # 2 times (27µs+229µs) by Role::Tiny::_concrete_methods_of at line 373 of Role/Tiny.pm, avg 128µs/call # 2 times (41µs+67µs) by Role::Tiny::import at line 86 of Role/Tiny.pm, avg 54µs/call
sub _non_methods {
14542µs my $self = shift;
14641µs my ($role) = @_;
147
148414µs456µs my $non_methods = $self->SUPER::_non_methods(@_);
# spent 56µs making 4 calls to Role::Tiny::_non_methods, avg 14µs/call
149
150412µs4155µs my $all_subs = $self->_all_subs($role);
# spent 155µs making 4 calls to Role::Tiny::_all_subs, avg 39µs/call
151 $non_methods->{$_} = $all_subs->{$_}
152421µs485µs for _check_tracked($role, [ keys %$all_subs ]);
# spent 85µs making 4 calls to Moo::_Utils::_check_tracked, avg 21µs/call
153
154414µs return $non_methods;
155}
156
157
# spent 703µs (236+467) within Moo::Role::is_role which was called 34 times, avg 21µs/call: # 17 times (91µs+238µs) by Role::Tiny::_check_roles at line 232 of Role/Tiny.pm, avg 19µs/call # 10 times (45µs+134µs) by Role::Tiny::_install_does at line 470 of Role/Tiny.pm, avg 18µs/call # 5 times (27µs+63µs) by MooX::HandlesVia::import at line 34 of MooX/HandlesVia.pm, avg 18µs/call # 2 times (73µs+32µs) by Role::Tiny::make_role at line 112 of Role/Tiny.pm, avg 52µs/call
sub is_role {
1583411µs my ($self, $role) = @_;
1593448µs34437µs $self->_inhale_if_moose($role);
# spent 437µs making 34 calls to Moo::Role::_inhale_if_moose, avg 13µs/call
1603475µs3430µs $self->SUPER::is_role($role);
# spent 30µs making 34 calls to Role::Tiny::is_role, avg 882ns/call
161}
162
163
# spent 437µs (298+139) within Moo::Role::_inhale_if_moose which was called 34 times, avg 13µs/call: # 34 times (298µs+139µs) by Moo::Role::is_role at line 159, avg 13µs/call
sub _inhale_if_moose {
164349µs my ($self, $role) = @_;
165345µs my $meta;
16634385µs68139µs if (!$self->SUPER::is_role($role)
# spent 86µs making 34 calls to Role::Tiny::is_role, avg 3µs/call # spent 53µs making 34 calls to UNIVERSAL::can, avg 2µ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 385µs (64+321) within Moo::Role::_maybe_make_accessors which was called 10 times, avg 38µs/call: # 10 times (64µs+321µs) by Role::Tiny::apply_roles_to_package at line 312 of Role/Tiny.pm, avg 38µs/call
sub _maybe_make_accessors {
252105µs my ($self, $target, $role) = @_;
253101µs my $m;
2541062µs10321µs if ($INFO{$role} && $INFO{$role}{inhaled_from_moose}
# spent 321µs making 10 calls to Moo::_accessor_maker_for, avg 32µ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 715µs (36+679) within Moo::Role::_undefer_subs which was called 10 times, avg 72µs/call: # 10 times (36µs+679µs) by Role::Tiny::apply_roles_to_package at line 312 of Role/Tiny.pm, avg 72µs/call
sub _undefer_subs {
287102µs my ($self, $target, $role) = @_;
2881039µs10679µs if ($INC{'Sub/Defer.pm'}) {
# spent 679µs making 10 calls to Sub::Defer::undefer_package, avg 68µs/call
289 Sub::Defer::undefer_package($role);
290 }
291}
292
293
# spent 57µs (41+16) within Moo::Role::role_application_steps which was called 10 times, avg 6µs/call: # 10 times (41µs+16µs) by Role::Tiny::apply_roles_to_package at line 301 of Role/Tiny.pm, avg 6µs/call
sub role_application_steps {
2941039µ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 1.75ms (43µs+1.70) within Moo::Role::_build_class_with_roles which was called: # once (43µs+1.70ms) 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) = @_;
30013µs $Moo::MAKERS{$new_name} = {is_class => 1};
30115µs11.68ms $me->SUPER::_build_class_with_roles($new_name, $superclass, @roles);
# spent 1.68ms making 1 call to Role::Tiny::_build_class_with_roles
302
30311µs if ($INC{'Moo/HandleMoose.pm'} && !$Moo::sification::disabled) {
304 Moo::HandleMoose::inject_fake_metaclass_for($new_name);
305 }
306
30711µs my $lvl = 0;
30810s my $file;
309115µs while ((my $pack, $file) = caller($lvl++)) {
310412µ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µs117µs _set_loaded($new_name, $file || (caller)[1]);
# spent 17µs making 1 call to Moo::_Utils::_set_loaded
315
31613µs return $new_name;
317}
318
319
# spent 9µs within Moo::Role::_gen_apply_defaults_for which was called: # once (9µs+0s) by Moo::Role::apply_roles_to_object at line 380
sub _gen_apply_defaults_for {
32011µs my ($me, $class, @roles) = @_;
321
32214µs my @attrs = map @{$INFO{$_}{attributes}||[]}, @roles;
323
32411µs my $con_gen;
325 my $m;
326
327 return undef
32814µ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;
3602746µs2118µs
# spent 66µs (14+52) within Moo::Role::BEGIN@360 which was called: # once (14µs+52µs) by MooX::TypeTiny::import at line 360
no warnings 'void';
# spent 66µs making 1 call to Moo::Role::BEGIN@360 # spent 52µ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 4.74ms (134µs+4.61) within Moo::Role::apply_roles_to_object which was called 7 times, avg 678µs/call: # 7 times (134µs+4.61ms) 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 678µs/call
sub apply_roles_to_object {
37574µs my ($me, $object, @roles) = @_;
376721µs74.55ms my $new = $me->SUPER::apply_roles_to_object($object, @roles);
# spent 4.55ms making 7 calls to Role::Tiny::apply_roles_to_object, avg 650µs/call
37776µs my $class = ref $new;
378752µs754µs _set_loaded($class, (caller)[1]);
# spent 54µs making 7 calls to Moo::_Utils::_set_loaded, avg 8µs/call
379
380714µs19µs if (!exists $APPLY_DEFAULTS{$class}) {
# spent 9µs making 1 call to Moo::Role::_gen_apply_defaults_for
381 $APPLY_DEFAULTS{$class} = $me->_gen_apply_defaults_for($class, @roles);
382 }
38376µ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 }
388727µs return $new;
389}
390
391
# spent 849µs (27+822) within Moo::Role::_install_single_modifier which was called 2 times, avg 424µs/call: # 2 times (27µs+822µs) by Role::Tiny::_install_modifiers at line 444 of Role/Tiny.pm, avg 424µs/call
sub _install_single_modifier {
39223µs my ($me, @args) = @_;
393211µs2822µs _install_modifier(@args);
# spent 822µs making 2 calls to Moo::_Utils::_install_modifier, avg 411µs/call
394}
395
396
# spent 766µs (75+691) within Moo::Role::_install_does which was called 10 times, avg 77µs/call: # 10 times (75µs+691µs) by Role::Tiny::_install_methods at line 428 of Role/Tiny.pm, avg 77µs/call
sub _install_does {
397105µs my ($me, $to) = @_;
398
399 # If Role::Tiny actually installed the DOES, give it a name
4001028µs10536µs my $new = $me->SUPER::_install_does($to) or return;
# spent 536µs making 10 calls to Role::Tiny::_install_does, avg 54µs/call
4011040µs10155µs return _name_coderef("${to}::DOES", $new);
# spent 155µs making 10 calls to Moo::_Utils::_name_coderef, avg 16µs/call
402}
403
404
# spent 3.88ms (1.44+2.45) within Moo::Role::does_role which was called 603 times, avg 6µs/call: # 556 times (1.15ms+1.96ms) 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 6µs/call # 46 times (273µs+476µ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 16µs/call # once (12µs+12µ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 {
405603117µs my ($proto, $role) = @_;
4066031.36ms6032.45ms return 1
# spent 2.45ms making 603 calls to Role::Tiny::does_role, avg 4µs/call
407 if Role::Tiny::does_role($proto, $role);
40875µs my $meta;
40974µ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 }
416724µs return 0;
417}
418
419
# spent 57µs within Moo::Role::_handle_constructor which was called 10 times, avg 6µs/call: # 10 times (57µs+0s) by Role::Tiny::apply_roles_to_package at line 312 of Role/Tiny.pm, avg 6µs/call
sub _handle_constructor {
420107µs my ($me, $to, $role) = @_;
4211011µs my $attr_info = $INFO{$role} && $INFO{$role}{attributes};
4221047µ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
44418µs1;
445__END__
 
# spent 5µs within Moo::Role::CORE:sort which was called 2 times, avg 2µs/call: # 2 times (5µs+0s) by Moo::Role::_install_subs at line 70, avg 2µs/call
sub Moo::Role::CORE:sort; # opcode