Filename | /Users/ether/.perlbrew/libs/36.0@std/lib/perl5/Moo/_Utils.pm |
Statements | Executed 2010 statements in 11.8ms |
Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
---|---|---|---|---|---|
4 | 2 | 1 | 5.21ms | 8.66ms | _require | Moo::_Utils::
1 | 1 | 1 | 2.83ms | 3.49ms | BEGIN@37 | Moo::_Utils::
17 | 3 | 3 | 2.17ms | 7.89ms | _install_modifier | Moo::_Utils::
1 | 1 | 1 | 1.83ms | 2.41ms | BEGIN@12 | Moo::_Utils::
1 | 1 | 1 | 876µs | 974µs | BEGIN@35 | Moo::_Utils::
119 | 1 | 1 | 647µs | 1.49ms | _install_coderef | Moo::_Utils::
1 | 1 | 1 | 590µs | 1.12ms | BEGIN@167 | Moo::_Utils::
119 | 3 | 3 | 567µs | 2.18ms | _install_tracked | Moo::_Utils::
21 | 2 | 2 | 483µs | 538µs | _check_tracked | Moo::_Utils::
1 | 1 | 1 | 478µs | 591µs | BEGIN@36 | Moo::_Utils::
206 | 5 | 5 | 470µs | 470µs | _getglob | Moo::_Utils::
129 | 2 | 2 | 345µs | 783µs | _name_coderef | Moo::_Utils::
26 | 2 | 2 | 190µs | 8.89ms | _load_module | Moo::_Utils::
55 | 4 | 1 | 188µs | 188µs | CORE:subst (opcode) | Moo::_Utils::
27 | 4 | 2 | 176µs | 277µs | _set_loaded | Moo::_Utils::
27 | 2 | 1 | 142µs | 142µs | CORE:match (opcode) | Moo::_Utils::
41 | 4 | 3 | 90µs | 90µs | _getstash | Moo::_Utils::
1 | 1 | 1 | 50µs | 56µs | BEGIN@141 | Moo::_Utils::
2 | 2 | 1 | 43µs | 43µs | CORE:regcomp (opcode) | Moo::_Utils::
1 | 1 | 1 | 37µs | 37µs | BEGIN@209 | Moo::_Utils::
1 | 1 | 1 | 28µs | 214µs | _maybe_load_module | Moo::_Utils::
1 | 1 | 1 | 26µs | 29µs | BEGIN@2 | Moo::_Utils::
1 | 1 | 1 | 20µs | 38µs | BEGIN@228 | Moo::_Utils::
1 | 1 | 1 | 15µs | 28µs | BEGIN@235 | Moo::_Utils::
1 | 1 | 1 | 11µs | 19µs | BEGIN@278 | Moo::_Utils::
1 | 1 | 1 | 9µs | 16µs | BEGIN@6 | Moo::_Utils::
1 | 1 | 1 | 6µs | 17µs | BEGIN@7 | Moo::_Utils::
1 | 1 | 1 | 5µs | 28µs | BEGIN@3 | Moo::_Utils::
1 | 1 | 1 | 3µs | 3µs | BEGIN@33 | Moo::_Utils::
1 | 1 | 1 | 3µs | 3µs | CORE:qr (opcode) | Moo::_Utils::
1 | 1 | 1 | 1µs | 1µs | BEGIN@34 | 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 | 39µs | 2 | 32µs | # spent 29µs (26+3) within Moo::_Utils::BEGIN@2 which was called:
# once (26µs+3µs) by Moo::BEGIN@6 at line 2 # spent 29µs making 1 call to Moo::_Utils::BEGIN@2
# spent 3µs making 1 call to strict::import |
3 | 2 | 31µs | 2 | 51µs | # spent 28µs (5+23) within Moo::_Utils::BEGIN@3 which was called:
# once (5µs+23µs) by Moo::BEGIN@6 at line 3 # spent 28µs making 1 call to Moo::_Utils::BEGIN@3
# spent 23µs making 1 call to warnings::import |
4 | |||||
5 | { | ||||
6 | 2 | 29µs | 2 | 23µs | # spent 16µs (9+7) within Moo::_Utils::BEGIN@6 which was called:
# once (9µs+7µs) by Moo::BEGIN@6 at line 6 # spent 16µs making 1 call to Moo::_Utils::BEGIN@6
# spent 7µs making 1 call to strict::unimport |
7 | 2 | 412µs | 2 | 28µs | # spent 17µs (6+11) within Moo::_Utils::BEGIN@7 which was called:
# once (6µs+11µs) by Moo::BEGIN@6 at line 7 # spent 17µs making 1 call to Moo::_Utils::BEGIN@7
# spent 11µs making 1 call to warnings::unimport |
8 | 206 | 695µs | # spent 470µs within Moo::_Utils::_getglob which was called 206 times, avg 2µs/call:
# 119 times (219µs+0s) by Moo::_Utils::_install_coderef at line 227, avg 2µs/call
# 74 times (187µs+0s) by Method::Generate::Constructor::current_constructor at line 109 of Method/Generate/Constructor.pm, avg 3µs/call
# 9 times (27µs+0s) by Method::Generate::BuildAll::buildall_body_for at line 34 of Method/Generate/BuildAll.pm, avg 3µs/call
# 2 times (32µs+0s) by Moo::_set_superclasses at line 153 of Moo.pm, avg 16µs/call
# 2 times (5µs+0s) by Moo::Role::_install_subs at line 71 of Moo/Role.pm, avg 2µs/call | ||
9 | 41 | 120µs | # spent 90µs within Moo::_Utils::_getstash which was called 41 times, avg 2µs/call:
# 21 times (55µs+0s) by Moo::_Utils::_check_tracked at line 247, avg 3µs/call
# 17 times (30µs+0s) by Moo::make_class at line 60 of Moo.pm, avg 2µs/call
# 2 times (3µs+0s) by Moo::_set_superclasses at line 156 of Moo.pm, avg 2µs/call
# once (2µs+0s) by Method::Generate::Constructor::new at line 247 of Method/Generate/Constructor.pm | ||
10 | } | ||||
11 | |||||
12 | 1 | 1µs | # spent 2.41ms (1.83+585µs) within Moo::_Utils::BEGIN@12 which was called:
# once (1.83ms+585µs) by Moo::BEGIN@6 at line 31 | ||
13 | 1 | 0s | my ($su, $sn); | ||
14 | $su = $INC{'Sub/Util.pm'} && defined &Sub::Util::set_subname | ||||
15 | or $sn = $INC{'Sub/Name.pm'} | ||||
16 | 1 | 416µs | or $su = eval { require Sub::Util; } && defined &Sub::Util::set_subname | ||
17 | 1 | 2µs | or $sn = eval { require Sub::Name; }; | ||
18 | |||||
19 | *_subname = $su ? \&Sub::Util::set_subname | ||||
20 | : $sn ? \&Sub::Name::subname | ||||
21 | 1 | 1µs | : sub { $_[1] }; | ||
22 | 1 | 1µs | *_CAN_SUBNAME = ($su || $sn) ? sub(){1} : sub(){0}; | ||
23 | |||||
24 | 1 | 3µ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 | 1µs | ? 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 | 7µs | *_module_name_rx = sub(){$module_name_rx}; | ||
31 | 1 | 35µs | 1 | 2.41ms | } # spent 2.41ms making 1 call to Moo::_Utils::BEGIN@12 |
32 | |||||
33 | 2 | 19µ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 | 9µs | 1 | 1µs | # spent 1µs within Moo::_Utils::BEGIN@34 which was called:
# once (1µs+0s) by Moo::BEGIN@6 at line 34 # spent 1µs making 1 call to Moo::_Utils::BEGIN@34 |
35 | 2 | 275µs | 1 | 974µs | # spent 974µs (876+98) within Moo::_Utils::BEGIN@35 which was called:
# once (876µs+98µs) by Moo::BEGIN@6 at line 35 # spent 974µs making 1 call to Moo::_Utils::BEGIN@35 |
36 | 2 | 303µs | 2 | 645µs | # spent 591µs (478+113) within Moo::_Utils::BEGIN@36 which was called:
# once (478µs+113µs) by Moo::BEGIN@6 at line 36 # spent 591µs making 1 call to Moo::_Utils::BEGIN@36
# spent 54µs making 1 call to Exporter::import |
37 | 2 | 957µs | 2 | 3.53ms | # spent 3.49ms (2.83+667µs) within Moo::_Utils::BEGIN@37 which was called:
# once (2.83ms+667µs) by Moo::BEGIN@6 at line 37 # spent 3.49ms making 1 call to Moo::_Utils::BEGIN@37
# spent 38µs making 1 call to Exporter::import |
38 | |||||
39 | # this should be empty, but some CPAN modules expect these | ||||
40 | 1 | 2µs | our @EXPORT = qw( | ||
41 | _install_coderef | ||||
42 | _load_module | ||||
43 | ); | ||||
44 | |||||
45 | 1 | 2µ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 7.89ms (2.17+5.72) within Moo::_Utils::_install_modifier which was called 17 times, avg 464µs/call:
# 8 times (156µs+1.67ms) by Moo::around or Moo::before at line 131 of Moo.pm, avg 228µs/call
# 7 times (1.97ms+3.28ms) by MooX::TypeTiny::import at line 25 of MooX/TypeTiny.pm, avg 749µs/call
# 2 times (53µs+769µs) by Moo::Role::_install_single_modifier at line 393 of Moo/Role.pm, avg 411µs/call | ||||
66 | 17 | 5µs | my $target = $_[0]; | ||
67 | 17 | 11µs | my $type = $_[1]; | ||
68 | 17 | 5µs | my $code = $_[-1]; | ||
69 | 17 | 38µs | my @names = @_[2 .. $#_ - 1]; | ||
70 | |||||
71 | 17 | 16µs | @names = @{ $names[0] } | ||
72 | if ref($names[0]) eq 'ARRAY'; | ||||
73 | |||||
74 | 17 | 47µs | 17 | 453µs | my @tracked = _check_tracked($target, \@names); # spent 453µs making 17 calls to Moo::_Utils::_check_tracked, avg 27µs/call |
75 | |||||
76 | 17 | 17µs | if ($INC{'Sub/Defer.pm'}) { | ||
77 | for my $name (@names) { | ||||
78 | # CMM will throw for us if it doesn't exist | ||||
79 | 25 | 146µs | 50 | 94µs | if (my $to_modify = $target->can($name)) { # spent 52µs making 25 calls to Sub::Defer::undefer_sub, avg 2µs/call
# spent 42µs making 25 calls to UNIVERSAL::can, avg 2µs/call |
80 | Sub::Defer::undefer_sub($to_modify); | ||||
81 | } | ||||
82 | } | ||||
83 | } | ||||
84 | |||||
85 | 17 | 609µs | require Class::Method::Modifiers; | ||
86 | 17 | 49µs | 17 | 4.84ms | Class::Method::Modifiers::install_modifier(@_); # spent 4.84ms making 17 calls to Class::Method::Modifiers::install_modifier, avg 285µs/call |
87 | |||||
88 | 17 | 10µs | if (@tracked) { | ||
89 | 7 | 6µs | my $exports = $EXPORTS{$target}; | ||
90 | weaken($exports->{$_} = $target->can($_)) | ||||
91 | 7 | 107µs | 42 | 31µs | for @tracked; # spent 20µs making 21 calls to UNIVERSAL::can, avg 952ns/call
# spent 11µs making 21 calls to Scalar::Util::weaken, avg 524ns/call |
92 | } | ||||
93 | |||||
94 | 17 | 65µs | return; | ||
95 | } | ||||
96 | |||||
97 | # spent 2.18ms (567µs+1.62) within Moo::_Utils::_install_tracked which was called 119 times, avg 18µs/call:
# 102 times (465µs+1.37ms) by Moo::_install_subs at line 90 of Moo.pm, avg 18µs/call
# 12 times (60µs+162µs) by Moo::Role::_install_subs at line 70 of Moo/Role.pm, avg 18µs/call
# 5 times (42µs+89µs) by MooX::HandlesVia::import at line 38 of MooX/HandlesVia.pm, avg 26µs/call | ||||
98 | 119 | 27µs | my ($target, $name, $code) = @_; | ||
99 | 119 | 36µs | my $from = caller; | ||
100 | 119 | 352µs | 119 | 123µs | weaken($EXPORTS{$target}{$name} = $code); # spent 123µs making 119 calls to Scalar::Util::weaken, avg 1µs/call |
101 | 119 | 313µs | 119 | 1.49ms | _install_coderef("${target}::${name}", "${from}::${name}", $code); # spent 1.49ms making 119 calls to Moo::_Utils::_install_coderef, avg 13µs/call |
102 | } | ||||
103 | |||||
104 | sub Moo::_Util::__GUARD__::DESTROY { | ||||
105 | delete $INC{$_[0]->[0]} if @{$_[0]}; | ||||
106 | } | ||||
107 | |||||
108 | sub _require { | ||||
109 | 4 | 1µs | my ($file) = @_; | ||
110 | 4 | 4µs | my $guard = _WORK_AROUND_BROKEN_MODULE_STATE | ||
111 | && bless([ $file ], 'Moo::_Util::__GUARD__'); | ||||
112 | local %^H if _WORK_AROUND_HINT_LEAKAGE; | ||||
113 | 11 | 2.39ms | if (!eval { require $file; 1 }) { | ||
114 | 1 | 0s | my $e = $@ || "Can't locate $file"; | ||
115 | 1 | 0s | my $me = __FILE__; | ||
116 | 1 | 57µs | 2 | 42µs | $e =~ s{ at \Q$me\E line \d+\.\n\z}{}; # spent 33µs making 1 call to Moo::_Utils::CORE:regcomp
# spent 9µs making 1 call to Moo::_Utils::CORE:subst |
117 | 1 | 13µs | return $e; | ||
118 | } | ||||
119 | pop @$guard if _WORK_AROUND_BROKEN_MODULE_STATE; | ||||
120 | 3 | 12µs | return undef; | ||
121 | } | ||||
122 | |||||
123 | # spent 8.89ms (190µs+8.70) within Moo::_Utils::_load_module which was called 26 times, avg 342µs/call:
# 24 times (173µs+7.27ms) by Moo::Role::_require_module at line 76 of Moo/Role.pm, avg 310µs/call
# 2 times (17µs+1.43ms) by Moo::_set_superclasses at line 148 of Moo.pm, avg 726µs/call | ||||
124 | 26 | 13µs | my ($module) = @_; | ||
125 | 26 | 195µs | 26 | 141µs | croak qq{"$module" is not a module name!} # spent 141µs making 26 calls to Moo::_Utils::CORE:match, avg 5µs/call |
126 | unless $module =~ _module_name_rx; | ||||
127 | 26 | 129µs | 26 | 74µs | (my $file = "$module.pm") =~ s{::}{/}g; # spent 74µs making 26 calls to Moo::_Utils::CORE:subst, avg 3µs/call |
128 | return 1 | ||||
129 | 26 | 58µs | if $INC{$file}; | ||
130 | |||||
131 | 3 | 5µs | 3 | 8.49ms | my $e = _require $file; # spent 8.49ms making 3 calls to Moo::_Utils::_require, avg 2.83ms/call |
132 | 3 | 12µ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 | 439µs | 2 | 62µs | # spent 56µs (50+6) within Moo::_Utils::BEGIN@141 which was called:
# once (50µs+6µs) by Moo::BEGIN@6 at line 141 # spent 56µs making 1 call to Moo::_Utils::BEGIN@141
# spent 6µ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 214µs (28+186) within Moo::_Utils::_maybe_load_module which was called:
# once (28µs+186µ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 | 11µ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 | 171µs | my $e = _require $file; # spent 171µs making 1 call to Moo::_Utils::_require |
158 | 1 | 21µs | 2 | 11µs | if (!defined $e) { # spent 10µ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.12ms (590µs+528µs) within Moo::_Utils::BEGIN@167 which was called:
# once (590µs+528µs) by Moo::BEGIN@6 at line 207 | ||||
168 | # optimize for newer perls | ||||
169 | require mro | ||||
170 | 1 | 397µs | if "$]" >= 5.009_005; | ||
171 | |||||
172 | 1 | 6µ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 | 115µs | 1 | 1.12ms | } # spent 1.12ms making 1 call to Moo::_Utils::BEGIN@167 |
208 | |||||
209 | # spent 37µs within Moo::_Utils::BEGIN@209 which was called:
# once (37µs+0s) by Moo::BEGIN@6 at line 219 | ||||
210 | 1 | 2µ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 | 4µs | *_in_global_destruction_code = sub () { $gd_code }; | ||
217 | 1 | 28µs | eval "sub _in_global_destruction () { $gd_code }; 1" # spent 2µs executing statements in string eval | ||
218 | or die $@; | ||||
219 | 1 | 73µs | 1 | 37µs | } # spent 37µs making 1 call to Moo::_Utils::BEGIN@209 |
220 | |||||
221 | # spent 277µs (176+101) within Moo::_Utils::_set_loaded which was called 27 times, avg 10µs/call:
# 17 times (118µs+63µs) by Moo::import at line 44 of Moo.pm, avg 11µs/call
# 7 times (32µs+22µs) by Moo::Role::apply_roles_to_object at line 378 of Moo/Role.pm, avg 8µs/call
# 2 times (16µs+9µs) by Moo::Role::import at line 54 of Moo/Role.pm, avg 12µs/call
# once (10µs+7µs) by Moo::Role::_build_class_with_roles at line 314 of Moo/Role.pm | ||||
222 | 27 | 206µs | 27 | 101µs | (my $file = "$_[0].pm") =~ s{::}{/}g; # spent 101µs making 27 calls to Moo::_Utils::CORE:subst, avg 4µs/call |
223 | 27 | 75µs | $INC{$file} ||= $_[1]; | ||
224 | } | ||||
225 | |||||
226 | # spent 1.49ms (647µs+847µs) within Moo::_Utils::_install_coderef which was called 119 times, avg 13µs/call:
# 119 times (647µs+847µs) by Moo::_Utils::_install_tracked at line 101, avg 13µs/call | ||||
227 | 119 | 182µs | 238 | 847µs | my ($glob, $code) = (_getglob($_[0]), _name_coderef(@_)); # spent 628µs making 119 calls to Moo::_Utils::_name_coderef, avg 5µs/call
# spent 219µs making 119 calls to Moo::_Utils::_getglob, avg 2µs/call |
228 | 2 | 60µs | 2 | 56µs | # spent 38µs (20+18) within Moo::_Utils::BEGIN@228 which was called:
# once (20µs+18µs) by Moo::BEGIN@6 at line 228 # spent 38µs making 1 call to Moo::_Utils::BEGIN@228
# spent 18µs making 1 call to warnings::unimport |
229 | 119 | 205µ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 | 229µs | 2 | 41µs | # spent 28µs (15+13) within Moo::_Utils::BEGIN@235 which was called:
# once (15µs+13µs) by Moo::BEGIN@6 at line 235 # spent 28µs making 1 call to Moo::_Utils::BEGIN@235
# spent 13µs making 1 call to warnings::unimport |
236 | 114 | 36µs | *{$glob} = $code; | ||
237 | } | ||||
238 | } | ||||
239 | |||||
240 | # spent 783µs (345+438) within Moo::_Utils::_name_coderef which was called 129 times, avg 6µs/call:
# 119 times (289µs+339µs) by Moo::_Utils::_install_coderef at line 227, avg 5µs/call
# 10 times (56µs+99µs) by Moo::Role::_install_does at line 401 of Moo/Role.pm, avg 16µs/call | ||||
241 | 129 | 34µs | shift if @_ > 2; # three args is (target, name, sub) | ||
242 | 129 | 889µs | 129 | 438µs | _CAN_SUBNAME ? _subname(@_) : $_[1]; # spent 438µs making 129 calls to Sub::Util::set_subname, avg 3µs/call |
243 | } | ||||
244 | |||||
245 | # spent 538µs (483+55) within Moo::_Utils::_check_tracked which was called 21 times, avg 26µs/call:
# 17 times (407µs+46µs) by Moo::_Utils::_install_modifier at line 74, avg 27µs/call
# 4 times (76µs+9µs) by Moo::Role::_non_methods at line 152 of Moo/Role.pm, avg 21µs/call | ||||
246 | 21 | 9µs | my ($target, $names) = @_; | ||
247 | 21 | 46µs | 21 | 55µs | my $stash = _getstash($target); # spent 55µs making 21 calls to Moo::_Utils::_getstash, avg 3µs/call |
248 | 21 | 38µs | my $exports = $EXPORTS{$target} | ||
249 | or return; | ||||
250 | |||||
251 | 17 | 12µs | $names = [keys %$exports] | ||
252 | if !$names; | ||||
253 | my %rev = | ||||
254 | map +($exports->{$_} => $_), | ||||
255 | 17 | 142µs | grep defined $exports->{$_}, | ||
256 | keys %$exports; | ||||
257 | |||||
258 | return | ||||
259 | grep { | ||||
260 | 65 | 170µs | my $g = $stash->{$_}; | ||
261 | 48 | 65µ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 | 183µs | 2 | 27µs | # spent 19µs (11+8) within Moo::_Utils::BEGIN@278 which was called:
# once (11µs+8µs) by Moo::BEGIN@6 at line 278 # spent 19µs making 1 call to Moo::_Utils::BEGIN@278
# spent 8µs making 1 call to strict::unimport |
279 | *$full_name = *{$old}{$type}; | ||||
280 | } | ||||
281 | } | ||||
282 | } | ||||
283 | |||||
284 | 1 | 7µs | 1 | 5µs | if ($Config::Config{useithreads}) { # spent 5µs making 1 call to Config::FETCH |
285 | require Moo::HandleMoose::_TypeMap; | ||||
286 | } | ||||
287 | |||||
288 | 1 | 6µ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 188µs within Moo::_Utils::CORE:subst which was called 55 times, avg 3µs/call:
# 27 times (101µs+0s) by Moo::_Utils::_set_loaded at line 222, avg 4µs/call
# 26 times (74µs+0s) by Moo::_Utils::_load_module at line 127, avg 3µs/call
# once (9µs+0s) by Moo::_Utils::_require at line 116
# once (4µs+0s) by Moo::_Utils::_maybe_load_module at line 155 |