Filename | /Users/ether/.perlbrew/libs/36.0@std/lib/perl5/Moo/_Utils.pm |
Statements | Executed 1989 statements in 12.8ms |
Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
---|---|---|---|---|---|
1 | 1 | 1 | 4.40ms | 5.54ms | BEGIN@37 | Moo::_Utils::
4 | 2 | 1 | 4.24ms | 7.11ms | _require | Moo::_Utils::
1 | 1 | 1 | 2.97ms | 4.23ms | BEGIN@12 | Moo::_Utils::
16 | 3 | 3 | 2.52ms | 7.94ms | _install_modifier | Moo::_Utils::
1 | 1 | 1 | 896µs | 2.74ms | BEGIN@167 | Moo::_Utils::
1 | 1 | 1 | 798µs | 856µs | BEGIN@35 | Moo::_Utils::
1 | 1 | 1 | 775µs | 913µs | BEGIN@36 | Moo::_Utils::
119 | 1 | 1 | 665µs | 1.55ms | _install_coderef | Moo::_Utils::
119 | 3 | 3 | 634µs | 2.27ms | _install_tracked | Moo::_Utils::
206 | 5 | 5 | 521µs | 521µs | _getglob | Moo::_Utils::
20 | 2 | 2 | 401µs | 449µs | _check_tracked | Moo::_Utils::
129 | 2 | 2 | 307µs | 731µs | _name_coderef | Moo::_Utils::
26 | 2 | 2 | 266µs | 7.31ms | _load_module | Moo::_Utils::
55 | 4 | 1 | 208µs | 208µs | CORE:subst (opcode) | Moo::_Utils::
27 | 4 | 2 | 158µs | 258µs | _set_loaded | Moo::_Utils::
27 | 2 | 1 | 109µs | 109µs | CORE:match (opcode) | Moo::_Utils::
40 | 4 | 3 | 87µs | 87µs | _getstash | Moo::_Utils::
1 | 1 | 1 | 52µs | 52µs | BEGIN@209 | Moo::_Utils::
2 | 2 | 1 | 44µs | 44µs | CORE:regcomp (opcode) | Moo::_Utils::
1 | 1 | 1 | 32µs | 34µs | BEGIN@2 | Moo::_Utils::
1 | 1 | 1 | 27µs | 308µs | _maybe_load_module | Moo::_Utils::
1 | 1 | 1 | 11µs | 19µs | BEGIN@141 | Moo::_Utils::
1 | 1 | 1 | 8µs | 29µs | BEGIN@228 | Moo::_Utils::
1 | 1 | 1 | 8µs | 15µs | BEGIN@278 | Moo::_Utils::
1 | 1 | 1 | 5µs | 13µs | BEGIN@235 | Moo::_Utils::
1 | 1 | 1 | 5µs | 31µs | BEGIN@3 | Moo::_Utils::
1 | 1 | 1 | 5µs | 11µ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@33 | Moo::_Utils::
1 | 1 | 1 | 2µs | 2µs | BEGIN@34 | Moo::_Utils::
1 | 1 | 1 | 1µs | 14µ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 | 30µs | 2 | 36µs | # spent 34µs (32+2) within Moo::_Utils::BEGIN@2 which was called:
# once (32µs+2µs) by Moo::BEGIN@6 at line 2 # spent 34µs making 1 call to Moo::_Utils::BEGIN@2
# spent 2µs making 1 call to strict::import |
3 | 2 | 27µs | 2 | 57µs | # spent 31µs (5+26) within Moo::_Utils::BEGIN@3 which was called:
# once (5µs+26µs) by Moo::BEGIN@6 at line 3 # spent 31µs making 1 call to Moo::_Utils::BEGIN@3
# spent 26µs making 1 call to warnings::import |
4 | |||||
5 | { | ||||
6 | 2 | 19µs | 2 | 17µs | # spent 11µs (5+6) within Moo::_Utils::BEGIN@6 which was called:
# once (5µs+6µs) by Moo::BEGIN@6 at line 6 # spent 11µs making 1 call to Moo::_Utils::BEGIN@6
# spent 6µs making 1 call to strict::unimport |
7 | 2 | 382µs | 2 | 27µs | # spent 14µs (1+13) within Moo::_Utils::BEGIN@7 which was called:
# once (1µs+13µs) by Moo::BEGIN@6 at line 7 # spent 14µs making 1 call to Moo::_Utils::BEGIN@7
# spent 13µs making 1 call to warnings::unimport |
8 | 206 | 700µs | # spent 521µs within Moo::_Utils::_getglob which was called 206 times, avg 3µs/call:
# 119 times (268µs+0s) by Moo::_Utils::_install_coderef at line 227, avg 2µs/call
# 74 times (195µs+0s) by Method::Generate::Constructor::current_constructor at line 109 of Method/Generate/Constructor.pm, avg 3µs/call
# 9 times (49µs+0s) by Method::Generate::BuildAll::buildall_body_for at line 34 of Method/Generate/BuildAll.pm, avg 5µs/call
# 2 times (6µs+0s) by Moo::_set_superclasses at line 153 of Moo.pm, avg 3µs/call
# 2 times (3µs+0s) by Moo::Role::_install_subs at line 71 of Moo/Role.pm, avg 2µs/call | ||
9 | 40 | 142µs | # spent 87µs within Moo::_Utils::_getstash which was called 40 times, avg 2µs/call:
# 20 times (48µs+0s) by Moo::_Utils::_check_tracked at line 247, avg 2µs/call
# 17 times (33µ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 (2µs+0s) by Method::Generate::Constructor::new at line 247 of Method/Generate/Constructor.pm | ||
10 | } | ||||
11 | |||||
12 | 1 | 0s | # spent 4.23ms (2.97+1.26) within Moo::_Utils::BEGIN@12 which was called:
# once (2.97ms+1.26ms) 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 | 705µ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 | 2µs | : sub { $_[1] }; | ||
22 | 1 | 0s | *_CAN_SUBNAME = ($su || $sn) ? sub(){1} : sub(){0}; | ||
23 | |||||
24 | 1 | 2µ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 | 10µs | *_module_name_rx = sub(){$module_name_rx}; | ||
31 | 1 | 32µs | 1 | 4.23ms | } # spent 4.23ms making 1 call to Moo::_Utils::BEGIN@12 |
32 | |||||
33 | 2 | 19µs | 1 | 2µs | # spent 2µs within Moo::_Utils::BEGIN@33 which was called:
# once (2µs+0s) by Moo::BEGIN@6 at line 33 # spent 2µs making 1 call to Moo::_Utils::BEGIN@33 |
34 | 1 | 10µ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 | 415µs | 1 | 856µs | # spent 856µs (798+58) within Moo::_Utils::BEGIN@35 which was called:
# once (798µs+58µs) by Moo::BEGIN@6 at line 35 # spent 856µs making 1 call to Moo::_Utils::BEGIN@35 |
36 | 2 | 555µs | 2 | 979µs | # spent 913µs (775+138) within Moo::_Utils::BEGIN@36 which was called:
# once (775µs+138µs) by Moo::BEGIN@6 at line 36 # spent 913µs making 1 call to Moo::_Utils::BEGIN@36
# spent 66µs making 1 call to Exporter::import |
37 | 2 | 1.03ms | 2 | 5.63ms | # spent 5.54ms (4.40+1.15) within Moo::_Utils::BEGIN@37 which was called:
# once (4.40ms+1.15ms) by Moo::BEGIN@6 at line 37 # spent 5.54ms making 1 call to Moo::_Utils::BEGIN@37
# spent 90µ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 | 0s | my %EXPORTS; | ||
64 | |||||
65 | # spent 7.94ms (2.52+5.42) within Moo::_Utils::_install_modifier which was called 16 times, avg 496µs/call:
# 7 times (2.33ms+3.37ms) by MooX::TypeTiny::import at line 25 of MooX/TypeTiny.pm, avg 814µs/call
# 7 times (152µs+1.48ms) by Moo::around or Moo::before at line 131 of Moo.pm, avg 233µs/call
# 2 times (39µs+572µs) by Moo::Role::_install_single_modifier at line 393 of Moo/Role.pm, avg 306µs/call | ||||
66 | 16 | 8µs | my $target = $_[0]; | ||
67 | 16 | 7µs | my $type = $_[1]; | ||
68 | 16 | 5µs | my $code = $_[-1]; | ||
69 | 16 | 80µs | my @names = @_[2 .. $#_ - 1]; | ||
70 | |||||
71 | 16 | 37µs | @names = @{ $names[0] } | ||
72 | if ref($names[0]) eq 'ARRAY'; | ||||
73 | |||||
74 | 16 | 40µs | 16 | 378µs | my @tracked = _check_tracked($target, \@names); # spent 378µs making 16 calls to Moo::_Utils::_check_tracked, avg 24µs/call |
75 | |||||
76 | 16 | 14µs | if ($INC{'Sub/Defer.pm'}) { | ||
77 | for my $name (@names) { | ||||
78 | # CMM will throw for us if it doesn't exist | ||||
79 | 24 | 222µs | 48 | 163µs | if (my $to_modify = $target->can($name)) { # spent 113µs making 24 calls to UNIVERSAL::can, avg 5µs/call
# spent 50µs making 24 calls to Sub::Defer::undefer_sub, avg 2µs/call |
80 | Sub::Defer::undefer_sub($to_modify); | ||||
81 | } | ||||
82 | } | ||||
83 | } | ||||
84 | |||||
85 | 16 | 888µs | require Class::Method::Modifiers; | ||
86 | 16 | 26µs | 16 | 4.59ms | Class::Method::Modifiers::install_modifier(@_); # spent 4.59ms making 16 calls to Class::Method::Modifiers::install_modifier, avg 287µs/call |
87 | |||||
88 | 16 | 9µs | if (@tracked) { | ||
89 | 7 | 9µs | my $exports = $EXPORTS{$target}; | ||
90 | weaken($exports->{$_} = $target->can($_)) | ||||
91 | 7 | 122µs | 42 | 34µs | for @tracked; # spent 20µs making 21 calls to Scalar::Util::weaken, avg 952ns/call
# spent 14µs making 21 calls to UNIVERSAL::can, avg 667ns/call |
92 | } | ||||
93 | |||||
94 | 16 | 51µs | return; | ||
95 | } | ||||
96 | |||||
97 | # spent 2.27ms (634µs+1.64) within Moo::_Utils::_install_tracked which was called 119 times, avg 19µs/call:
# 102 times (538µs+1.37ms) by Moo::_install_subs at line 90 of Moo.pm, avg 19µs/call
# 12 times (58µs+164µs) by Moo::Role::_install_subs at line 70 of Moo/Role.pm, avg 18µs/call
# 5 times (38µs+105µs) by MooX::HandlesVia::import at line 38 of MooX/HandlesVia.pm, avg 29µs/call | ||||
98 | 119 | 65µs | my ($target, $name, $code) = @_; | ||
99 | 119 | 31µs | my $from = caller; | ||
100 | 119 | 330µs | 119 | 89µs | weaken($EXPORTS{$target}{$name} = $code); # spent 89µs making 119 calls to Scalar::Util::weaken, avg 748ns/call |
101 | 119 | 365µs | 119 | 1.55ms | _install_coderef("${target}::${name}", "${from}::${name}", $code); # spent 1.55ms 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 | 3µs | my ($file) = @_; | ||
110 | 4 | 3µ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.11ms | if (!eval { require $file; 1 }) { | ||
114 | 1 | 0s | my $e = $@ || "Can't locate $file"; | ||
115 | 1 | 1µs | my $me = __FILE__; | ||
116 | 1 | 50µs | 2 | 39µs | $e =~ s{ at \Q$me\E line \d+\.\n\z}{}; # spent 32µs making 1 call to Moo::_Utils::CORE:regcomp
# spent 7µs making 1 call to Moo::_Utils::CORE:subst |
117 | 1 | 5µs | return $e; | ||
118 | } | ||||
119 | pop @$guard if _WORK_AROUND_BROKEN_MODULE_STATE; | ||||
120 | 3 | 16µs | return undef; | ||
121 | } | ||||
122 | |||||
123 | # spent 7.31ms (266µs+7.05) within Moo::_Utils::_load_module which was called 26 times, avg 281µs/call:
# 24 times (234µs+5.64ms) by Moo::Role::_require_module at line 76 of Moo/Role.pm, avg 245µs/call
# 2 times (32µs+1.40ms) by Moo::_set_superclasses at line 148 of Moo.pm, avg 718µs/call | ||||
124 | 26 | 14µs | my ($module) = @_; | ||
125 | 26 | 193µs | 26 | 108µs | croak qq{"$module" is not a module name!} # spent 108µs making 26 calls to Moo::_Utils::CORE:match, avg 4µs/call |
126 | unless $module =~ _module_name_rx; | ||||
127 | 26 | 158µs | 26 | 75µs | (my $file = "$module.pm") =~ s{::}{/}g; # spent 75µs making 26 calls to Moo::_Utils::CORE:subst, avg 3µs/call |
128 | return 1 | ||||
129 | 26 | 69µs | if $INC{$file}; | ||
130 | |||||
131 | 3 | 7µs | 3 | 6.86ms | my $e = _require $file; # spent 6.86ms making 3 calls to Moo::_Utils::_require, avg 2.29ms/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 | 345µs | 2 | 27µs | # spent 19µs (11+8) within Moo::_Utils::BEGIN@141 which was called:
# once (11µs+8µs) by Moo::BEGIN@6 at line 141 # spent 19µs making 1 call to Moo::_Utils::BEGIN@141
# spent 8µ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 308µs (27+281) within Moo::_Utils::_maybe_load_module which was called:
# once (27µs+281µ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 | 35µs | 1 | 26µs | (my $file = "$module.pm") =~ s{::}{/}g; # spent 26µs making 1 call to Moo::_Utils::CORE:subst |
156 | |||||
157 | 1 | 3µs | 1 | 242µs | my $e = _require $file; # spent 242µs making 1 call to Moo::_Utils::_require |
158 | 1 | 21µs | 2 | 13µs | if (!defined $e) { # spent 12µ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 | 5µs | return $MAYBE_LOADED{$module} = 0; | ||
165 | } | ||||
166 | |||||
167 | # spent 2.74ms (896µs+1.85) within Moo::_Utils::BEGIN@167 which was called:
# once (896µs+1.85ms) by Moo::BEGIN@6 at line 207 | ||||
168 | # optimize for newer perls | ||||
169 | require mro | ||||
170 | 1 | 636µ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 | 125µs | 1 | 2.74ms | } # spent 2.74ms making 1 call to Moo::_Utils::BEGIN@167 |
208 | |||||
209 | # spent 52µs within Moo::_Utils::BEGIN@209 which was called:
# once (52µ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 | 5µs | *_in_global_destruction_code = sub () { $gd_code }; | ||
217 | 1 | 41µs | eval "sub _in_global_destruction () { $gd_code }; 1" # spent 3µs executing statements in string eval | ||
218 | or die $@; | ||||
219 | 1 | 115µs | 1 | 52µs | } # spent 52µs making 1 call to Moo::_Utils::BEGIN@209 |
220 | |||||
221 | # spent 258µs (158+100) within Moo::_Utils::_set_loaded which was called 27 times, avg 10µs/call:
# 17 times (101µs+67µs) by Moo::import at line 44 of Moo.pm, avg 10µs/call
# 7 times (34µs+21µs) by Moo::Role::apply_roles_to_object at line 378 of Moo/Role.pm, avg 8µs/call
# 2 times (16µs+8µs) by Moo::Role::import at line 54 of Moo/Role.pm, avg 12µs/call
# once (7µs+4µs) by Moo::Role::_build_class_with_roles at line 314 of Moo/Role.pm | ||||
222 | 27 | 185µs | 27 | 100µs | (my $file = "$_[0].pm") =~ s{::}{/}g; # spent 100µ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.55ms (665µs+885µs) within Moo::_Utils::_install_coderef which was called 119 times, avg 13µs/call:
# 119 times (665µs+885µs) by Moo::_Utils::_install_tracked at line 101, avg 13µs/call | ||||
227 | 119 | 202µs | 238 | 885µs | my ($glob, $code) = (_getglob($_[0]), _name_coderef(@_)); # spent 617µs making 119 calls to Moo::_Utils::_name_coderef, avg 5µs/call
# spent 268µs making 119 calls to Moo::_Utils::_getglob, avg 2µs/call |
228 | 2 | 37µs | 2 | 50µs | # spent 29µs (8+21) within Moo::_Utils::BEGIN@228 which was called:
# once (8µs+21µs) by Moo::BEGIN@6 at line 228 # spent 29µs making 1 call to Moo::_Utils::BEGIN@228
# spent 21µs making 1 call to warnings::unimport |
229 | 119 | 222µ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 | 223µs | 2 | 21µs | # spent 13µs (5+8) within Moo::_Utils::BEGIN@235 which was called:
# once (5µs+8µs) by Moo::BEGIN@6 at line 235 # spent 13µs making 1 call to Moo::_Utils::BEGIN@235
# spent 8µs making 1 call to warnings::unimport |
236 | 114 | 31µs | *{$glob} = $code; | ||
237 | } | ||||
238 | } | ||||
239 | |||||
240 | # spent 731µs (307+424) within Moo::_Utils::_name_coderef which was called 129 times, avg 6µs/call:
# 119 times (267µs+350µs) by Moo::_Utils::_install_coderef at line 227, avg 5µs/call
# 10 times (40µs+74µs) by Moo::Role::_install_does at line 401 of Moo/Role.pm, avg 11µs/call | ||||
241 | 129 | 28µs | shift if @_ > 2; # three args is (target, name, sub) | ||
242 | 129 | 845µs | 129 | 424µs | _CAN_SUBNAME ? _subname(@_) : $_[1]; # spent 424µs making 129 calls to Sub::Util::set_subname, avg 3µs/call |
243 | } | ||||
244 | |||||
245 | # spent 449µs (401+48) within Moo::_Utils::_check_tracked which was called 20 times, avg 22µs/call:
# 16 times (337µs+41µs) by Moo::_Utils::_install_modifier at line 74, avg 24µs/call
# 4 times (64µs+7µs) by Moo::Role::_non_methods at line 152 of Moo/Role.pm, avg 18µs/call | ||||
246 | 20 | 11µs | my ($target, $names) = @_; | ||
247 | 20 | 32µs | 20 | 48µs | my $stash = _getstash($target); # spent 48µs making 20 calls to Moo::_Utils::_getstash, avg 2µs/call |
248 | 20 | 23µs | my $exports = $EXPORTS{$target} | ||
249 | or return; | ||||
250 | |||||
251 | 16 | 2µs | $names = [keys %$exports] | ||
252 | if !$names; | ||||
253 | my %rev = | ||||
254 | map +($exports->{$_} => $_), | ||||
255 | 16 | 132µs | grep defined $exports->{$_}, | ||
256 | keys %$exports; | ||||
257 | |||||
258 | return | ||||
259 | grep { | ||||
260 | 63 | 133µs | my $g = $stash->{$_}; | ||
261 | 47 | 50µ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 | 137µs | 2 | 22µs | # spent 15µs (8+7) within Moo::_Utils::BEGIN@278 which was called:
# once (8µs+7µs) by Moo::BEGIN@6 at line 278 # spent 15µs making 1 call to Moo::_Utils::BEGIN@278
# spent 7µs making 1 call to strict::unimport |
279 | *$full_name = *{$old}{$type}; | ||||
280 | } | ||||
281 | } | ||||
282 | } | ||||
283 | |||||
284 | 1 | 10µs | 1 | 4µs | if ($Config::Config{useithreads}) { # spent 4µs making 1 call to Config::FETCH |
285 | require Moo::HandleMoose::_TypeMap; | ||||
286 | } | ||||
287 | |||||
288 | 1 | 7µ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 208µs within Moo::_Utils::CORE:subst which was called 55 times, avg 4µs/call:
# 27 times (100µs+0s) by Moo::_Utils::_set_loaded at line 222, avg 4µs/call
# 26 times (75µs+0s) by Moo::_Utils::_load_module at line 127, avg 3µs/call
# once (26µs+0s) by Moo::_Utils::_maybe_load_module at line 155
# once (7µs+0s) by Moo::_Utils::_require at line 116 |