Filename | /Users/ether/.perlbrew/libs/36.0@std/lib/perl5/Moo/_Utils.pm |
Statements | Executed 1989 statements in 12.3ms |
Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
---|---|---|---|---|---|
1 | 1 | 1 | 4.36ms | 5.54ms | BEGIN@37 | Moo::_Utils::
4 | 2 | 1 | 4.04ms | 7.26ms | _require | Moo::_Utils::
1 | 1 | 1 | 2.13ms | 3.66ms | BEGIN@12 | Moo::_Utils::
16 | 3 | 3 | 1.56ms | 6.49ms | _install_modifier | Moo::_Utils::
119 | 3 | 3 | 817µs | 2.74ms | _install_tracked | Moo::_Utils::
1 | 1 | 1 | 798µs | 1.70ms | BEGIN@167 | Moo::_Utils::
119 | 1 | 1 | 681µs | 1.77ms | _install_coderef | Moo::_Utils::
206 | 5 | 5 | 646µs | 646µs | _getglob | Moo::_Utils::
1 | 1 | 1 | 577µs | 648µs | BEGIN@35 | Moo::_Utils::
1 | 1 | 1 | 382µs | 484µs | BEGIN@36 | Moo::_Utils::
20 | 2 | 2 | 364µs | 418µs | _check_tracked | Moo::_Utils::
129 | 2 | 2 | 339µs | 853µs | _name_coderef | Moo::_Utils::
55 | 4 | 1 | 231µs | 231µs | CORE:subst (opcode) | Moo::_Utils::
26 | 2 | 2 | 213µs | 7.52ms | _load_module | Moo::_Utils::
1 | 1 | 1 | 210µs | 210µs | BEGIN@209 | Moo::_Utils::
27 | 4 | 2 | 188µs | 329µs | _set_loaded | Moo::_Utils::
27 | 2 | 1 | 144µs | 144µs | CORE:match (opcode) | Moo::_Utils::
40 | 4 | 3 | 96µs | 96µs | _getstash | Moo::_Utils::
2 | 2 | 1 | 44µs | 44µs | CORE:regcomp (opcode) | Moo::_Utils::
1 | 1 | 1 | 24µs | 217µs | _maybe_load_module | Moo::_Utils::
1 | 1 | 1 | 21µs | 74µs | BEGIN@228 | Moo::_Utils::
1 | 1 | 1 | 20µs | 36µs | BEGIN@141 | Moo::_Utils::
1 | 1 | 1 | 18µs | 39µs | BEGIN@278 | Moo::_Utils::
1 | 1 | 1 | 16µs | 18µs | BEGIN@2 | Moo::_Utils::
1 | 1 | 1 | 11µs | 32µs | BEGIN@235 | Moo::_Utils::
1 | 1 | 1 | 4µs | 18µs | BEGIN@3 | Moo::_Utils::
1 | 1 | 1 | 3µs | 3µs | BEGIN@33 | Moo::_Utils::
1 | 1 | 1 | 3µs | 8µs | BEGIN@6 | Moo::_Utils::
1 | 1 | 1 | 3µs | 3µs | CORE:qr (opcode) | Moo::_Utils::
1 | 1 | 1 | 2µs | 2µs | BEGIN@34 | Moo::_Utils::
1 | 1 | 1 | 2µs | 17µs | BEGIN@7 | Moo::_Utils::
0 | 0 | 0 | 0s | 0s | DESTROY | Moo::_Util::__GUARD__::
0 | 0 | 0 | 0s | 0s | __ANON__[:216] | Moo::_Utils::
0 | 0 | 0 | 0s | 0s | __ANON__[:21] | Moo::_Utils::
0 | 0 | 0 | 0s | 0s | __ANON__[:30] | Moo::_Utils::
0 | 0 | 0 | 0s | 0s | _unimport_coderefs | Moo::_Utils::
Line | State ments |
Time on line |
Calls | Time in subs |
Code |
---|---|---|---|---|---|
1 | package Moo::_Utils; | ||||
2 | 2 | 22µs | 2 | 20µs | # spent 18µs (16+2) within Moo::_Utils::BEGIN@2 which was called:
# once (16µs+2µs) by Moo::BEGIN@6 at line 2 # spent 18µs making 1 call to Moo::_Utils::BEGIN@2
# spent 2µs making 1 call to strict::import |
3 | 2 | 15µs | 2 | 32µs | # spent 18µs (4+14) within Moo::_Utils::BEGIN@3 which was called:
# once (4µs+14µs) by Moo::BEGIN@6 at line 3 # spent 18µs making 1 call to Moo::_Utils::BEGIN@3
# spent 14µs making 1 call to warnings::import |
4 | |||||
5 | { | ||||
6 | 2 | 28µs | 2 | 13µs | # spent 8µs (3+5) within Moo::_Utils::BEGIN@6 which was called:
# once (3µs+5µs) by Moo::BEGIN@6 at line 6 # spent 8µs making 1 call to Moo::_Utils::BEGIN@6
# spent 5µs making 1 call to strict::unimport |
7 | 2 | 262µs | 2 | 32µs | # spent 17µs (2+15) within Moo::_Utils::BEGIN@7 which was called:
# once (2µs+15µs) by Moo::BEGIN@6 at line 7 # spent 17µs making 1 call to Moo::_Utils::BEGIN@7
# spent 15µs making 1 call to warnings::unimport |
8 | 206 | 800µs | # spent 646µs within Moo::_Utils::_getglob which was called 206 times, avg 3µs/call:
# 119 times (350µs+0s) by Moo::_Utils::_install_coderef at line 227, avg 3µs/call
# 74 times (247µs+0s) by Method::Generate::Constructor::current_constructor at line 109 of Method/Generate/Constructor.pm, avg 3µs/call
# 9 times (36µs+0s) by Method::Generate::BuildAll::buildall_body_for at line 34 of Method/Generate/BuildAll.pm, avg 4µs/call
# 2 times (7µs+0s) by Moo::Role::_install_subs at line 71 of Moo/Role.pm, avg 4µs/call
# 2 times (6µs+0s) by Moo::_set_superclasses at line 153 of Moo.pm, avg 3µs/call | ||
9 | 40 | 124µs | # spent 96µs within Moo::_Utils::_getstash which was called 40 times, avg 2µs/call:
# 20 times (54µs+0s) by Moo::_Utils::_check_tracked at line 247, avg 3µs/call
# 17 times (35µs+0s) by Moo::make_class at line 60 of Moo.pm, avg 2µs/call
# 2 times (4µs+0s) by Moo::_set_superclasses at line 156 of Moo.pm, avg 2µs/call
# once (3µs+0s) by Method::Generate::Constructor::new at line 247 of Method/Generate/Constructor.pm | ||
10 | } | ||||
11 | |||||
12 | 1 | 1µs | # spent 3.66ms (2.13+1.53) within Moo::_Utils::BEGIN@12 which was called:
# once (2.13ms+1.53ms) by Moo::BEGIN@6 at line 31 | ||
13 | 1 | 1µs | my ($su, $sn); | ||
14 | $su = $INC{'Sub/Util.pm'} && defined &Sub::Util::set_subname | ||||
15 | or $sn = $INC{'Sub/Name.pm'} | ||||
16 | 1 | 176µs | or $su = eval { require Sub::Util; } && defined &Sub::Util::set_subname | ||
17 | 1 | 1µs | or $sn = eval { require Sub::Name; }; | ||
18 | |||||
19 | *_subname = $su ? \&Sub::Util::set_subname | ||||
20 | : $sn ? \&Sub::Name::subname | ||||
21 | 1 | 2µs | : sub { $_[1] }; | ||
22 | 1 | 1µs | *_CAN_SUBNAME = ($su || $sn) ? sub(){1} : sub(){0}; | ||
23 | |||||
24 | 1 | 4µs | *_WORK_AROUND_BROKEN_MODULE_STATE = "$]" < 5.009 ? sub(){1} : sub(){0}; | ||
25 | *_WORK_AROUND_HINT_LEAKAGE | ||||
26 | = "$]" < 5.011 && !("$]" >= 5.009004 && "$]" < 5.010001) | ||||
27 | 1 | 0s | ? sub(){1} : sub(){0}; | ||
28 | |||||
29 | 1 | 6µs | 1 | 3µs | my $module_name_rx = qr/\A(?!\d)\w+(?:::\w+)*\z/; # spent 3µs making 1 call to Moo::_Utils::CORE:qr |
30 | 1 | 10µs | *_module_name_rx = sub(){$module_name_rx}; | ||
31 | 1 | 40µs | 1 | 3.66ms | } # spent 3.66ms making 1 call to Moo::_Utils::BEGIN@12 |
32 | |||||
33 | 2 | 23µs | 1 | 3µs | # spent 3µs within Moo::_Utils::BEGIN@33 which was called:
# once (3µs+0s) by Moo::BEGIN@6 at line 33 # spent 3µs making 1 call to Moo::_Utils::BEGIN@33 |
34 | 1 | 11µs | 1 | 2µs | # spent 2µs within Moo::_Utils::BEGIN@34 which was called:
# once (2µs+0s) by Moo::BEGIN@6 at line 34 # spent 2µs making 1 call to Moo::_Utils::BEGIN@34 |
35 | 2 | 190µs | 1 | 648µs | # spent 648µs (577+71) within Moo::_Utils::BEGIN@35 which was called:
# once (577µs+71µs) by Moo::BEGIN@6 at line 35 # spent 648µs making 1 call to Moo::_Utils::BEGIN@35 |
36 | 2 | 165µs | 2 | 548µs | # spent 484µs (382+102) within Moo::_Utils::BEGIN@36 which was called:
# once (382µs+102µs) by Moo::BEGIN@6 at line 36 # spent 484µs making 1 call to Moo::_Utils::BEGIN@36
# spent 64µs making 1 call to Exporter::import |
37 | 2 | 1.19ms | 2 | 5.61ms | # spent 5.54ms (4.36+1.18) within Moo::_Utils::BEGIN@37 which was called:
# once (4.36ms+1.18ms) by Moo::BEGIN@6 at line 37 # spent 5.54ms making 1 call to Moo::_Utils::BEGIN@37
# spent 66µs making 1 call to Exporter::import |
38 | |||||
39 | # this should be empty, but some CPAN modules expect these | ||||
40 | 1 | 5µs | our @EXPORT = qw( | ||
41 | _install_coderef | ||||
42 | _load_module | ||||
43 | ); | ||||
44 | |||||
45 | 1 | 8µs | our @EXPORT_OK = qw( | ||
46 | _check_tracked | ||||
47 | _getglob | ||||
48 | _getstash | ||||
49 | _install_coderef | ||||
50 | _install_modifier | ||||
51 | _install_tracked | ||||
52 | _load_module | ||||
53 | _maybe_load_module | ||||
54 | _module_name_rx | ||||
55 | _name_coderef | ||||
56 | _set_loaded | ||||
57 | _unimport_coderefs | ||||
58 | _linear_isa | ||||
59 | _in_global_destruction | ||||
60 | _in_global_destruction_code | ||||
61 | ); | ||||
62 | |||||
63 | 1 | 1µs | my %EXPORTS; | ||
64 | |||||
65 | # spent 6.49ms (1.56+4.93) within Moo::_Utils::_install_modifier which was called 16 times, avg 406µs/call:
# 7 times (1.35ms+2.99ms) by MooX::TypeTiny::import at line 25 of MooX/TypeTiny.pm, avg 621µs/call
# 7 times (173µs+1.64ms) by Moo::around or Moo::before at line 131 of Moo.pm, avg 258µs/call
# 2 times (31µs+301µs) by Moo::Role::_install_single_modifier at line 393 of Moo/Role.pm, avg 166µs/call | ||||
66 | 16 | 8µs | my $target = $_[0]; | ||
67 | 16 | 10µs | my $type = $_[1]; | ||
68 | 16 | 4µs | my $code = $_[-1]; | ||
69 | 16 | 37µs | my @names = @_[2 .. $#_ - 1]; | ||
70 | |||||
71 | 16 | 19µs | @names = @{ $names[0] } | ||
72 | if ref($names[0]) eq 'ARRAY'; | ||||
73 | |||||
74 | 16 | 34µs | 16 | 345µs | my @tracked = _check_tracked($target, \@names); # spent 345µs making 16 calls to Moo::_Utils::_check_tracked, avg 22µs/call |
75 | |||||
76 | 16 | 20µs | if ($INC{'Sub/Defer.pm'}) { | ||
77 | for my $name (@names) { | ||||
78 | # CMM will throw for us if it doesn't exist | ||||
79 | 24 | 156µs | 48 | 148µs | if (my $to_modify = $target->can($name)) { # spent 106µs making 24 calls to Sub::Defer::undefer_sub, avg 4µs/call
# spent 42µs making 24 calls to UNIVERSAL::can, avg 2µs/call |
80 | Sub::Defer::undefer_sub($to_modify); | ||||
81 | } | ||||
82 | } | ||||
83 | } | ||||
84 | |||||
85 | 16 | 379µs | require Class::Method::Modifiers; | ||
86 | 16 | 32µs | 16 | 4.23ms | Class::Method::Modifiers::install_modifier(@_); # spent 4.23ms making 16 calls to Class::Method::Modifiers::install_modifier, avg 264µs/call |
87 | |||||
88 | 16 | 8µs | if (@tracked) { | ||
89 | 7 | 7µs | my $exports = $EXPORTS{$target}; | ||
90 | weaken($exports->{$_} = $target->can($_)) | ||||
91 | 7 | 122µs | 42 | 42µs | for @tracked; # spent 26µs making 21 calls to UNIVERSAL::can, avg 1µs/call
# spent 16µs making 21 calls to Scalar::Util::weaken, avg 762ns/call |
92 | } | ||||
93 | |||||
94 | 16 | 55µs | return; | ||
95 | } | ||||
96 | |||||
97 | # spent 2.74ms (817µs+1.92) within Moo::_Utils::_install_tracked which was called 119 times, avg 23µs/call:
# 102 times (576µs+1.57ms) by Moo::_install_subs at line 90 of Moo.pm, avg 21µs/call
# 12 times (135µs+193µs) by Moo::Role::_install_subs at line 70 of Moo/Role.pm, avg 27µs/call
# 5 times (106µs+159µs) by MooX::HandlesVia::import at line 38 of MooX/HandlesVia.pm, avg 53µs/call | ||||
98 | 119 | 36µs | my ($target, $name, $code) = @_; | ||
99 | 119 | 40µs | my $from = caller; | ||
100 | 119 | 446µs | 119 | 150µs | weaken($EXPORTS{$target}{$name} = $code); # spent 150µs making 119 calls to Scalar::Util::weaken, avg 1µs/call |
101 | 119 | 489µs | 119 | 1.77ms | _install_coderef("${target}::${name}", "${from}::${name}", $code); # spent 1.77ms making 119 calls to Moo::_Utils::_install_coderef, avg 15µs/call |
102 | } | ||||
103 | |||||
104 | sub Moo::_Util::__GUARD__::DESTROY { | ||||
105 | delete $INC{$_[0]->[0]} if @{$_[0]}; | ||||
106 | } | ||||
107 | |||||
108 | sub _require { | ||||
109 | 4 | 3µs | my ($file) = @_; | ||
110 | 4 | 2µs | my $guard = _WORK_AROUND_BROKEN_MODULE_STATE | ||
111 | && bless([ $file ], 'Moo::_Util::__GUARD__'); | ||||
112 | local %^H if _WORK_AROUND_HINT_LEAKAGE; | ||||
113 | 11 | 1.95ms | if (!eval { require $file; 1 }) { | ||
114 | 1 | 1µs | my $e = $@ || "Can't locate $file"; | ||
115 | 1 | 1µs | my $me = __FILE__; | ||
116 | 1 | 52µs | 2 | 38µs | $e =~ s{ at \Q$me\E line \d+\.\n\z}{}; # spent 30µs making 1 call to Moo::_Utils::CORE:regcomp
# spent 8µs making 1 call to Moo::_Utils::CORE:subst |
117 | 1 | 7µs | return $e; | ||
118 | } | ||||
119 | pop @$guard if _WORK_AROUND_BROKEN_MODULE_STATE; | ||||
120 | 3 | 9µs | return undef; | ||
121 | } | ||||
122 | |||||
123 | # spent 7.52ms (213µs+7.30) within Moo::_Utils::_load_module which was called 26 times, avg 289µs/call:
# 24 times (196µs+6.04ms) by Moo::Role::_require_module at line 76 of Moo/Role.pm, avg 260µs/call
# 2 times (17µs+1.26ms) by Moo::_set_superclasses at line 148 of Moo.pm, avg 640µs/call | ||||
124 | 26 | 14µs | my ($module) = @_; | ||
125 | 26 | 208µs | 26 | 143µs | croak qq{"$module" is not a module name!} # spent 143µs making 26 calls to Moo::_Utils::CORE:match, avg 6µs/call |
126 | unless $module =~ _module_name_rx; | ||||
127 | 26 | 137µs | 26 | 78µs | (my $file = "$module.pm") =~ s{::}{/}g; # spent 78µs making 26 calls to Moo::_Utils::CORE:subst, avg 3µs/call |
128 | return 1 | ||||
129 | 26 | 55µs | if $INC{$file}; | ||
130 | |||||
131 | 3 | 7µs | 3 | 7.08ms | my $e = _require $file; # spent 7.08ms making 3 calls to Moo::_Utils::_require, avg 2.36ms/call |
132 | 3 | 10µs | return 1 | ||
133 | if !defined $e; | ||||
134 | |||||
135 | croak $e | ||||
136 | if $e !~ /\ACan't locate \Q$file\E /; | ||||
137 | |||||
138 | # can't just ->can('can') because a sub-package Foo::Bar::Baz | ||||
139 | # creates a 'Baz::' key in Foo::Bar's symbol table | ||||
140 | my $stash = _getstash($module)||{}; | ||||
141 | 2 | 396µs | 2 | 52µs | # spent 36µs (20+16) within Moo::_Utils::BEGIN@141 which was called:
# once (20µs+16µs) by Moo::BEGIN@6 at line 141 # spent 36µs making 1 call to Moo::_Utils::BEGIN@141
# spent 16µs making 1 call to strict::unimport |
142 | return 1 if grep +exists &{"${module}::$_"}, grep !/::\z/, keys %$stash; | ||||
143 | return 1 | ||||
144 | if $INC{"Moose.pm"} && Class::MOP::class_of($module) | ||||
145 | or Mouse::Util->can('find_meta') && Mouse::Util::find_meta($module); | ||||
146 | |||||
147 | croak $e; | ||||
148 | } | ||||
149 | |||||
150 | our %MAYBE_LOADED; | ||||
151 | # spent 217µs (24+193) within Moo::_Utils::_maybe_load_module which was called:
# once (24µs+193µs) by Method::Generate::Accessor::BEGIN@18 at line 27 of Method/Generate/Accessor.pm | ||||
152 | 1 | 1µs | my $module = $_[0]; | ||
153 | return $MAYBE_LOADED{$module} | ||||
154 | 1 | 1µs | if exists $MAYBE_LOADED{$module}; | ||
155 | 1 | 10µs | 1 | 4µs | (my $file = "$module.pm") =~ s{::}{/}g; # spent 4µs making 1 call to Moo::_Utils::CORE:subst |
156 | |||||
157 | 1 | 3µs | 1 | 174µs | my $e = _require $file; # spent 174µs making 1 call to Moo::_Utils::_require |
158 | 1 | 23µs | 2 | 15µs | if (!defined $e) { # spent 14µs making 1 call to Moo::_Utils::CORE:regcomp
# spent 1µs making 1 call to Moo::_Utils::CORE:match |
159 | return $MAYBE_LOADED{$module} = 1; | ||||
160 | } | ||||
161 | elsif ($e !~ /\ACan't locate \Q$file\E /) { | ||||
162 | warn "$module exists but failed to load with error: $e"; | ||||
163 | } | ||||
164 | 1 | 6µs | return $MAYBE_LOADED{$module} = 0; | ||
165 | } | ||||
166 | |||||
167 | # spent 1.70ms (798µs+903µs) within Moo::_Utils::BEGIN@167 which was called:
# once (798µs+903µs) by Moo::BEGIN@6 at line 207 | ||||
168 | # optimize for newer perls | ||||
169 | require mro | ||||
170 | 1 | 411µs | if "$]" >= 5.009_005; | ||
171 | |||||
172 | 1 | 64µs | if (defined &mro::get_linear_isa) { | ||
173 | *_linear_isa = \&mro::get_linear_isa; | ||||
174 | } | ||||
175 | else { | ||||
176 | my $e; | ||||
177 | { | ||||
178 | local $@; | ||||
179 | eval <<'END_CODE' or $e = $@; | ||||
180 | sub _linear_isa($;$) { | ||||
181 | my $class = shift; | ||||
182 | my $type = shift || exists $Class::C3::MRO{$class} ? 'c3' : 'dfs'; | ||||
183 | |||||
184 | if ($type eq 'c3') { | ||||
185 | require Class::C3; | ||||
186 | return [Class::C3::calculateMRO($class)]; | ||||
187 | } | ||||
188 | |||||
189 | my @check = ($class); | ||||
190 | my @lin; | ||||
191 | |||||
192 | my %found; | ||||
193 | while (defined(my $check = shift @check)) { | ||||
194 | push @lin, $check; | ||||
195 | no strict 'refs'; | ||||
196 | unshift @check, grep !$found{$_}++, @{"$check\::ISA"}; | ||||
197 | } | ||||
198 | |||||
199 | return \@lin; | ||||
200 | } | ||||
201 | |||||
202 | 1; | ||||
203 | END_CODE | ||||
204 | } | ||||
205 | die $e if defined $e; | ||||
206 | } | ||||
207 | 1 | 438µs | 1 | 1.70ms | } # spent 1.70ms making 1 call to Moo::_Utils::BEGIN@167 |
208 | |||||
209 | # spent 210µs within Moo::_Utils::BEGIN@209 which was called:
# once (210µs+0s) by Moo::BEGIN@6 at line 219 | ||||
210 | 1 | 10µs | my $gd_code | ||
211 | = "$]" >= 5.014 | ||||
212 | ? q[${^GLOBAL_PHASE} eq 'DESTRUCT'] | ||||
213 | : _maybe_load_module('Devel::GlobalDestruction::XS') | ||||
214 | ? 'Devel::GlobalDestruction::XS::in_global_destruction()' | ||||
215 | : 'do { use B (); ${B::main_cv()} == 0 }'; | ||||
216 | 1 | 33µs | *_in_global_destruction_code = sub () { $gd_code }; | ||
217 | 1 | 160µs | eval "sub _in_global_destruction () { $gd_code }; 1" # spent 5µs executing statements in string eval | ||
218 | or die $@; | ||||
219 | 1 | 243µs | 1 | 210µs | } # spent 210µs making 1 call to Moo::_Utils::BEGIN@209 |
220 | |||||
221 | # spent 329µs (188+141) within Moo::_Utils::_set_loaded which was called 27 times, avg 12µs/call:
# 17 times (105µs+99µs) by Moo::import at line 44 of Moo.pm, avg 12µs/call
# 7 times (53µs+26µs) by Moo::Role::apply_roles_to_object at line 378 of Moo/Role.pm, avg 11µs/call
# 2 times (23µs+13µs) by Moo::Role::import at line 54 of Moo/Role.pm, avg 18µs/call
# once (7µs+3µs) by Moo::Role::_build_class_with_roles at line 314 of Moo/Role.pm | ||||
222 | 27 | 247µs | 27 | 141µs | (my $file = "$_[0].pm") =~ s{::}{/}g; # spent 141µs making 27 calls to Moo::_Utils::CORE:subst, avg 5µs/call |
223 | 27 | 82µs | $INC{$file} ||= $_[1]; | ||
224 | } | ||||
225 | |||||
226 | # spent 1.77ms (681µs+1.09) within Moo::_Utils::_install_coderef which was called 119 times, avg 15µs/call:
# 119 times (681µs+1.09ms) by Moo::_Utils::_install_tracked at line 101, avg 15µs/call | ||||
227 | 119 | 276µs | 238 | 1.09ms | my ($glob, $code) = (_getglob($_[0]), _name_coderef(@_)); # spent 741µs making 119 calls to Moo::_Utils::_name_coderef, avg 6µs/call
# spent 350µs making 119 calls to Moo::_Utils::_getglob, avg 3µs/call |
228 | 2 | 75µs | 2 | 127µs | # spent 74µs (21+53) within Moo::_Utils::BEGIN@228 which was called:
# once (21µs+53µs) by Moo::BEGIN@6 at line 228 # spent 74µs making 1 call to Moo::_Utils::BEGIN@228
# spent 53µs making 1 call to warnings::unimport |
229 | 119 | 245µs | if (*{$glob}{CODE}) { | ||
230 | *{$glob} = $code; | ||||
231 | } | ||||
232 | # perl will sometimes warn about mismatched prototypes coming from the | ||||
233 | # inheritance cache, so disable them if we aren't redefining a sub | ||||
234 | else { | ||||
235 | 2 | 350µs | 2 | 53µs | # spent 32µs (11+21) within Moo::_Utils::BEGIN@235 which was called:
# once (11µs+21µs) by Moo::BEGIN@6 at line 235 # spent 32µs making 1 call to Moo::_Utils::BEGIN@235
# spent 21µs making 1 call to warnings::unimport |
236 | 114 | 31µs | *{$glob} = $code; | ||
237 | } | ||||
238 | } | ||||
239 | |||||
240 | # spent 853µs (339+514) within Moo::_Utils::_name_coderef which was called 129 times, avg 7µs/call:
# 119 times (283µs+458µs) by Moo::_Utils::_install_coderef at line 227, avg 6µs/call
# 10 times (56µs+56µs) by Moo::Role::_install_does at line 401 of Moo/Role.pm, avg 11µs/call | ||||
241 | 129 | 40µs | shift if @_ > 2; # three args is (target, name, sub) | ||
242 | 129 | 949µs | 129 | 514µs | _CAN_SUBNAME ? _subname(@_) : $_[1]; # spent 514µs making 129 calls to Sub::Util::set_subname, avg 4µs/call |
243 | } | ||||
244 | |||||
245 | # spent 418µs (364+54) within Moo::_Utils::_check_tracked which was called 20 times, avg 21µs/call:
# 16 times (302µs+43µs) by Moo::_Utils::_install_modifier at line 74, avg 22µs/call
# 4 times (62µs+11µs) by Moo::Role::_non_methods at line 152 of Moo/Role.pm, avg 18µs/call | ||||
246 | 20 | 5µs | my ($target, $names) = @_; | ||
247 | 20 | 32µs | 20 | 54µs | my $stash = _getstash($target); # spent 54µs making 20 calls to Moo::_Utils::_getstash, avg 3µs/call |
248 | 20 | 26µs | my $exports = $EXPORTS{$target} | ||
249 | or return; | ||||
250 | |||||
251 | 16 | 3µs | $names = [keys %$exports] | ||
252 | if !$names; | ||||
253 | my %rev = | ||||
254 | map +($exports->{$_} => $_), | ||||
255 | 16 | 135µs | grep defined $exports->{$_}, | ||
256 | keys %$exports; | ||||
257 | |||||
258 | return | ||||
259 | grep { | ||||
260 | 63 | 125µs | my $g = $stash->{$_}; | ||
261 | 47 | 38µs | $g && defined &$g && exists $rev{\&$g}; | ||
262 | } | ||||
263 | @$names; | ||||
264 | } | ||||
265 | |||||
266 | sub _unimport_coderefs { | ||||
267 | my ($target) = @_; | ||||
268 | |||||
269 | my $stash = _getstash($target); | ||||
270 | my @exports = _check_tracked($target); | ||||
271 | |||||
272 | foreach my $name (@exports) { | ||||
273 | my $old = delete $stash->{$name}; | ||||
274 | my $full_name = join('::',$target,$name); | ||||
275 | # Copy everything except the code slot back into place (e.g. $has) | ||||
276 | foreach my $type (qw(SCALAR HASH ARRAY IO)) { | ||||
277 | next unless defined(*{$old}{$type}); | ||||
278 | 2 | 343µs | 2 | 60µs | # spent 39µs (18+21) within Moo::_Utils::BEGIN@278 which was called:
# once (18µs+21µs) by Moo::BEGIN@6 at line 278 # spent 39µs making 1 call to Moo::_Utils::BEGIN@278
# spent 21µs making 1 call to strict::unimport |
279 | *$full_name = *{$old}{$type}; | ||||
280 | } | ||||
281 | } | ||||
282 | } | ||||
283 | |||||
284 | 1 | 26µs | 1 | 9µs | if ($Config::Config{useithreads}) { # spent 9µs making 1 call to Config::FETCH |
285 | require Moo::HandleMoose::_TypeMap; | ||||
286 | } | ||||
287 | |||||
288 | 1 | 16µs | 1; | ||
sub Moo::_Utils::CORE:match; # opcode | |||||
# spent 3µs within Moo::_Utils::CORE:qr which was called:
# once (3µs+0s) by Moo::_Utils::BEGIN@12 at line 29 | |||||
sub Moo::_Utils::CORE:regcomp; # opcode | |||||
# spent 231µs within Moo::_Utils::CORE:subst which was called 55 times, avg 4µs/call:
# 27 times (141µs+0s) by Moo::_Utils::_set_loaded at line 222, avg 5µs/call
# 26 times (78µs+0s) by Moo::_Utils::_load_module at line 127, avg 3µs/call
# once (8µs+0s) by Moo::_Utils::_require at line 116
# once (4µs+0s) by Moo::_Utils::_maybe_load_module at line 155 |