| Filename | /Users/ether/.perlbrew/libs/36.0@std/lib/perl5/Moo/_Utils.pm |
| Statements | Executed 2010 statements in 14.9ms |
| Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
|---|---|---|---|---|---|
| 1 | 1 | 1 | 8.44ms | 14.5ms | Moo::_Utils::BEGIN@12 |
| 4 | 2 | 1 | 4.06ms | 6.69ms | Moo::_Utils::_require |
| 1 | 1 | 1 | 3.77ms | 5.13ms | Moo::_Utils::BEGIN@37 |
| 17 | 3 | 3 | 1.58ms | 5.45ms | Moo::_Utils::_install_modifier |
| 1 | 1 | 1 | 1.57ms | 1.64ms | Moo::_Utils::BEGIN@35 |
| 1 | 1 | 1 | 1.08ms | 1.19ms | Moo::_Utils::BEGIN@36 |
| 1 | 1 | 1 | 854µs | 5.22ms | Moo::_Utils::BEGIN@167 |
| 119 | 3 | 3 | 527µs | 1.99ms | Moo::_Utils::_install_tracked |
| 119 | 1 | 1 | 482µs | 1.38ms | Moo::_Utils::_install_coderef |
| 206 | 5 | 5 | 443µs | 443µs | Moo::_Utils::_getglob |
| 129 | 2 | 2 | 392µs | 778µs | Moo::_Utils::_name_coderef |
| 21 | 2 | 2 | 361µs | 399µs | Moo::_Utils::_check_tracked |
| 26 | 2 | 2 | 168µs | 6.66ms | Moo::_Utils::_load_module |
| 55 | 4 | 1 | 144µs | 144µs | Moo::_Utils::CORE:subst (opcode) |
| 27 | 4 | 2 | 120µs | 204µs | Moo::_Utils::_set_loaded |
| 41 | 4 | 3 | 105µs | 105µs | Moo::_Utils::_getstash |
| 27 | 2 | 1 | 94µs | 94µs | Moo::_Utils::CORE:match (opcode) |
| 1 | 1 | 1 | 38µs | 38µs | Moo::_Utils::BEGIN@209 |
| 2 | 2 | 1 | 32µs | 32µs | Moo::_Utils::CORE:regcomp (opcode) |
| 1 | 1 | 1 | 30µs | 384µs | Moo::_Utils::_maybe_load_module |
| 1 | 1 | 1 | 25µs | 27µs | Moo::_Utils::BEGIN@2 |
| 1 | 1 | 1 | 15µs | 31µs | Moo::_Utils::BEGIN@228 |
| 1 | 1 | 1 | 6µs | 10µs | Moo::_Utils::BEGIN@141 |
| 1 | 1 | 1 | 6µs | 12µs | Moo::_Utils::BEGIN@278 |
| 1 | 1 | 1 | 4µs | 20µs | Moo::_Utils::BEGIN@3 |
| 1 | 1 | 1 | 4µs | 8µs | Moo::_Utils::BEGIN@6 |
| 1 | 1 | 1 | 3µs | 10µs | Moo::_Utils::BEGIN@235 |
| 1 | 1 | 1 | 3µs | 3µs | Moo::_Utils::BEGIN@33 |
| 1 | 1 | 1 | 3µs | 3µs | Moo::_Utils::BEGIN@34 |
| 1 | 1 | 1 | 3µs | 10µs | Moo::_Utils::BEGIN@7 |
| 1 | 1 | 1 | 3µs | 3µs | Moo::_Utils::CORE:qr (opcode) |
| 0 | 0 | 0 | 0s | 0s | Moo::_Util::__GUARD__::DESTROY |
| 0 | 0 | 0 | 0s | 0s | Moo::_Utils::__ANON__[:216] |
| 0 | 0 | 0 | 0s | 0s | Moo::_Utils::__ANON__[:21] |
| 0 | 0 | 0 | 0s | 0s | Moo::_Utils::__ANON__[:30] |
| 0 | 0 | 0 | 0s | 0s | Moo::_Utils::_unimport_coderefs |
| Line | State ments |
Time on line |
Calls | Time in subs |
Code |
|---|---|---|---|---|---|
| 1 | package Moo::_Utils; | ||||
| 2 | 2 | 22µs | 2 | 29µs | # spent 27µs (25+2) within Moo::_Utils::BEGIN@2 which was called:
# once (25µs+2µs) by Moo::BEGIN@6 at line 2 # spent 27µs making 1 call to Moo::_Utils::BEGIN@2
# spent 2µs making 1 call to strict::import |
| 3 | 2 | 18µs | 2 | 36µs | # spent 20µs (4+16) within Moo::_Utils::BEGIN@3 which was called:
# once (4µs+16µs) by Moo::BEGIN@6 at line 3 # spent 20µs making 1 call to Moo::_Utils::BEGIN@3
# spent 16µs making 1 call to warnings::import |
| 4 | |||||
| 5 | { | ||||
| 6 | 2 | 17µs | 2 | 12µs | # spent 8µs (4+4) within Moo::_Utils::BEGIN@6 which was called:
# once (4µs+4µs) by Moo::BEGIN@6 at line 6 # spent 8µs making 1 call to Moo::_Utils::BEGIN@6
# spent 4µs making 1 call to strict::unimport |
| 7 | 2 | 265µs | 2 | 17µs | # spent 10µs (3+7) within Moo::_Utils::BEGIN@7 which was called:
# once (3µs+7µs) by Moo::BEGIN@6 at line 7 # spent 10µs making 1 call to Moo::_Utils::BEGIN@7
# spent 7µs making 1 call to warnings::unimport |
| 8 | 206 | 537µs | # spent 443µ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 (186µs+0s) by Method::Generate::Constructor::current_constructor at line 109 of Method/Generate/Constructor.pm, avg 3µs/call
# 9 times (31µs+0s) by Method::Generate::BuildAll::buildall_body_for at line 34 of Method/Generate/BuildAll.pm, avg 3µs/call
# 2 times (4µs+0s) by Moo::Role::_install_subs at line 71 of Moo/Role.pm, avg 2µs/call
# 2 times (3µs+0s) by Moo::_set_superclasses at line 153 of Moo.pm, avg 2µs/call | ||
| 9 | 41 | 118µs | # spent 105µs within Moo::_Utils::_getstash which was called 41 times, avg 3µs/call:
# 21 times (38µs+0s) by Moo::_Utils::_check_tracked at line 247, avg 2µs/call
# 17 times (61µs+0s) by Moo::make_class at line 60 of Moo.pm, avg 4µs/call
# 2 times (2µs+0s) by Moo::_set_superclasses at line 156 of Moo.pm, avg 1µs/call
# once (4µs+0s) by Method::Generate::Constructor::new at line 247 of Method/Generate/Constructor.pm | ||
| 10 | } | ||||
| 11 | |||||
| 12 | 1 | 1µs | # spent 14.5ms (8.44+6.02) within Moo::_Utils::BEGIN@12 which was called:
# once (8.44ms+6.02ms) 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 | 3.23ms | 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 | 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 | 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 | 49µs | 1 | 14.5ms | } # spent 14.5ms 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 | 14µs | 1 | 3µs | # spent 3µs within Moo::_Utils::BEGIN@34 which was called:
# once (3µs+0s) by Moo::BEGIN@6 at line 34 # spent 3µs making 1 call to Moo::_Utils::BEGIN@34 |
| 35 | 2 | 1.16ms | 1 | 1.64ms | # spent 1.64ms (1.57+75µs) within Moo::_Utils::BEGIN@35 which was called:
# once (1.57ms+75µs) by Moo::BEGIN@6 at line 35 # spent 1.64ms making 1 call to Moo::_Utils::BEGIN@35 |
| 36 | 2 | 914µs | 2 | 1.24ms | # spent 1.19ms (1.08+107µs) within Moo::_Utils::BEGIN@36 which was called:
# once (1.08ms+107µs) by Moo::BEGIN@6 at line 36 # spent 1.19ms making 1 call to Moo::_Utils::BEGIN@36
# spent 52µs making 1 call to Exporter::import |
| 37 | 2 | 1.02ms | 2 | 5.17ms | # spent 5.13ms (3.77+1.36) within Moo::_Utils::BEGIN@37 which was called:
# once (3.77ms+1.36ms) by Moo::BEGIN@6 at line 37 # spent 5.13ms making 1 call to Moo::_Utils::BEGIN@37
# spent 37µs making 1 call to Exporter::import |
| 38 | |||||
| 39 | # this should be empty, but some CPAN modules expect these | ||||
| 40 | 1 | 1µ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 5.45ms (1.58+3.86) within Moo::_Utils::_install_modifier which was called 17 times, avg 320µs/call:
# 8 times (135µs+1.22ms) by Moo::around or Moo::before at line 131 of Moo.pm, avg 169µs/call
# 7 times (1.42ms+2.38ms) by MooX::TypeTiny::import at line 25 of MooX/TypeTiny.pm, avg 543µs/call
# 2 times (25µs+269µs) by Moo::Role::_install_single_modifier at line 393 of Moo/Role.pm, avg 147µs/call | ||||
| 66 | 17 | 9µs | my $target = $_[0]; | ||
| 67 | 17 | 4µs | my $type = $_[1]; | ||
| 68 | 17 | 8µs | my $code = $_[-1]; | ||
| 69 | 17 | 34µs | my @names = @_[2 .. $#_ - 1]; | ||
| 70 | |||||
| 71 | 17 | 15µs | @names = @{ $names[0] } | ||
| 72 | if ref($names[0]) eq 'ARRAY'; | ||||
| 73 | |||||
| 74 | 17 | 29µs | 17 | 340µs | my @tracked = _check_tracked($target, \@names); # spent 340µs making 17 calls to Moo::_Utils::_check_tracked, avg 20µs/call |
| 75 | |||||
| 76 | 17 | 14µs | if ($INC{'Sub/Defer.pm'}) { | ||
| 77 | for my $name (@names) { | ||||
| 78 | # CMM will throw for us if it doesn't exist | ||||
| 79 | 25 | 108µs | 50 | 72µs | if (my $to_modify = $target->can($name)) { # spent 42µs making 25 calls to Sub::Defer::undefer_sub, avg 2µs/call
# spent 30µs making 25 calls to UNIVERSAL::can, avg 1µs/call |
| 80 | Sub::Defer::undefer_sub($to_modify); | ||||
| 81 | } | ||||
| 82 | } | ||||
| 83 | } | ||||
| 84 | |||||
| 85 | 17 | 523µs | require Class::Method::Modifiers; | ||
| 86 | 17 | 27µs | 17 | 3.25ms | Class::Method::Modifiers::install_modifier(@_); # spent 3.25ms making 17 calls to Class::Method::Modifiers::install_modifier, avg 191µs/call |
| 87 | |||||
| 88 | 17 | 6µs | if (@tracked) { | ||
| 89 | 7 | 4µs | my $exports = $EXPORTS{$target}; | ||
| 90 | weaken($exports->{$_} = $target->can($_)) | ||||
| 91 | 7 | 77µs | 42 | 25µs | for @tracked; # spent 13µs making 21 calls to UNIVERSAL::can, avg 619ns/call
# spent 12µs making 21 calls to Scalar::Util::weaken, avg 571ns/call |
| 92 | } | ||||
| 93 | |||||
| 94 | 17 | 38µs | return; | ||
| 95 | } | ||||
| 96 | |||||
| 97 | # spent 1.99ms (527µs+1.46) within Moo::_Utils::_install_tracked which was called 119 times, avg 17µs/call:
# 102 times (413µs+1.25ms) by Moo::_install_subs at line 90 of Moo.pm, avg 16µs/call
# 12 times (83µs+123µs) by Moo::Role::_install_subs at line 70 of Moo/Role.pm, avg 17µs/call
# 5 times (31µs+84µs) by MooX::HandlesVia::import at line 38 of MooX/HandlesVia.pm, avg 23µs/call | ||||
| 98 | 119 | 21µs | my ($target, $name, $code) = @_; | ||
| 99 | 119 | 25µs | my $from = caller; | ||
| 100 | 119 | 263µs | 119 | 80µs | weaken($EXPORTS{$target}{$name} = $code); # spent 80µs making 119 calls to Scalar::Util::weaken, avg 672ns/call |
| 101 | 119 | 246µs | 119 | 1.38ms | _install_coderef("${target}::${name}", "${from}::${name}", $code); # spent 1.38ms making 119 calls to Moo::_Utils::_install_coderef, avg 12µ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 | 1µ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.36ms | if (!eval { require $file; 1 }) { | ||
| 114 | 1 | 0s | my $e = $@ || "Can't locate $file"; | ||
| 115 | 1 | 0s | my $me = __FILE__; | ||
| 116 | 1 | 44µs | 2 | 32µs | $e =~ s{ at \Q$me\E line \d+\.\n\z}{}; # spent 26µs making 1 call to Moo::_Utils::CORE:regcomp
# spent 6µs making 1 call to Moo::_Utils::CORE:subst |
| 117 | 1 | 9µs | return $e; | ||
| 118 | } | ||||
| 119 | pop @$guard if _WORK_AROUND_BROKEN_MODULE_STATE; | ||||
| 120 | 3 | 8µs | return undef; | ||
| 121 | } | ||||
| 122 | |||||
| 123 | # spent 6.66ms (168µs+6.49) within Moo::_Utils::_load_module which was called 26 times, avg 256µs/call:
# 24 times (155µs+4.76ms) by Moo::Role::_require_module at line 76 of Moo/Role.pm, avg 205µs/call
# 2 times (13µs+1.73ms) by Moo::_set_superclasses at line 148 of Moo.pm, avg 874µs/call | ||||
| 124 | 26 | 10µs | my ($module) = @_; | ||
| 125 | 26 | 139µs | 26 | 93µs | croak qq{"$module" is not a module name!} # spent 93µs making 26 calls to Moo::_Utils::CORE:match, avg 4µs/call |
| 126 | unless $module =~ _module_name_rx; | ||||
| 127 | 26 | 105µs | 26 | 51µs | (my $file = "$module.pm") =~ s{::}{/}g; # spent 51µs making 26 calls to Moo::_Utils::CORE:subst, avg 2µs/call |
| 128 | return 1 | ||||
| 129 | 26 | 45µs | if $INC{$file}; | ||
| 130 | |||||
| 131 | 3 | 4µs | 3 | 6.34ms | my $e = _require $file; # spent 6.34ms making 3 calls to Moo::_Utils::_require, avg 2.12ms/call |
| 132 | 3 | 8µ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 | 194µs | 2 | 14µs | # spent 10µs (6+4) within Moo::_Utils::BEGIN@141 which was called:
# once (6µs+4µs) by Moo::BEGIN@6 at line 141 # spent 10µs making 1 call to Moo::_Utils::BEGIN@141
# spent 4µ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 384µs (30+354) within Moo::_Utils::_maybe_load_module which was called:
# once (30µs+354µ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 | 12µs | 1 | 3µs | (my $file = "$module.pm") =~ s{::}{/}g; # spent 3µs making 1 call to Moo::_Utils::CORE:subst |
| 156 | |||||
| 157 | 1 | 3µs | 1 | 344µs | my $e = _require $file; # spent 344µs making 1 call to Moo::_Utils::_require |
| 158 | 1 | 13µs | 2 | 7µs | if (!defined $e) { # spent 6µ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 5.22ms (854µs+4.36) within Moo::_Utils::BEGIN@167 which was called:
# once (854µs+4.36ms) by Moo::BEGIN@6 at line 207 | ||||
| 168 | # optimize for newer perls | ||||
| 169 | require mro | ||||
| 170 | 1 | 693µs | if "$]" >= 5.009_005; | ||
| 171 | |||||
| 172 | 1 | 5µ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 | 96µs | 1 | 5.22ms | } # spent 5.22ms making 1 call to Moo::_Utils::BEGIN@167 |
| 208 | |||||
| 209 | # spent 38µs within Moo::_Utils::BEGIN@209 which was called:
# once (38µ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 | 29µs | eval "sub _in_global_destruction () { $gd_code }; 1" # spent 2µs executing statements in string eval | ||
| 218 | or die $@; | ||||
| 219 | 1 | 76µs | 1 | 38µs | } # spent 38µs making 1 call to Moo::_Utils::BEGIN@209 |
| 220 | |||||
| 221 | # spent 204µs (120+84) within Moo::_Utils::_set_loaded which was called 27 times, avg 8µs/call:
# 17 times (85µs+58µs) by Moo::import at line 44 of Moo.pm, avg 8µs/call
# 7 times (20µs+15µs) by Moo::Role::apply_roles_to_object at line 378 of Moo/Role.pm, avg 5µs/call
# 2 times (11µs+8µs) by Moo::Role::import at line 54 of Moo/Role.pm, avg 10µs/call
# once (4µs+3µs) by Moo::Role::_build_class_with_roles at line 314 of Moo/Role.pm | ||||
| 222 | 27 | 154µs | 27 | 84µs | (my $file = "$_[0].pm") =~ s{::}{/}g; # spent 84µs making 27 calls to Moo::_Utils::CORE:subst, avg 3µs/call |
| 223 | 27 | 54µs | $INC{$file} ||= $_[1]; | ||
| 224 | } | ||||
| 225 | |||||
| 226 | # spent 1.38ms (482µs+898µs) within Moo::_Utils::_install_coderef which was called 119 times, avg 12µs/call:
# 119 times (482µs+898µs) by Moo::_Utils::_install_tracked at line 101, avg 12µs/call | ||||
| 227 | 119 | 180µs | 238 | 898µs | my ($glob, $code) = (_getglob($_[0]), _name_coderef(@_)); # spent 679µs making 119 calls to Moo::_Utils::_name_coderef, avg 6µs/call
# spent 219µs making 119 calls to Moo::_Utils::_getglob, avg 2µs/call |
| 228 | 2 | 30µs | 2 | 47µs | # spent 31µs (15+16) within Moo::_Utils::BEGIN@228 which was called:
# once (15µs+16µs) by Moo::BEGIN@6 at line 228 # spent 31µs making 1 call to Moo::_Utils::BEGIN@228
# spent 16µs making 1 call to warnings::unimport |
| 229 | 119 | 207µ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 | 151µs | 2 | 17µs | # spent 10µs (3+7) within Moo::_Utils::BEGIN@235 which was called:
# once (3µs+7µs) by Moo::BEGIN@6 at line 235 # spent 10µs making 1 call to Moo::_Utils::BEGIN@235
# spent 7µs making 1 call to warnings::unimport |
| 236 | 114 | 29µs | *{$glob} = $code; | ||
| 237 | } | ||||
| 238 | } | ||||
| 239 | |||||
| 240 | # spent 778µs (392+386) within Moo::_Utils::_name_coderef which was called 129 times, avg 6µs/call:
# 119 times (346µs+333µs) by Moo::_Utils::_install_coderef at line 227, avg 6µs/call
# 10 times (46µs+53µs) by Moo::Role::_install_does at line 401 of Moo/Role.pm, avg 10µs/call | ||||
| 241 | 129 | 36µs | shift if @_ > 2; # three args is (target, name, sub) | ||
| 242 | 129 | 827µs | 129 | 386µs | _CAN_SUBNAME ? _subname(@_) : $_[1]; # spent 386µs making 129 calls to Sub::Util::set_subname, avg 3µs/call |
| 243 | } | ||||
| 244 | |||||
| 245 | # spent 399µs (361+38) within Moo::_Utils::_check_tracked which was called 21 times, avg 19µs/call:
# 17 times (309µs+31µs) by Moo::_Utils::_install_modifier at line 74, avg 20µs/call
# 4 times (52µs+7µs) by Moo::Role::_non_methods at line 152 of Moo/Role.pm, avg 15µs/call | ||||
| 246 | 21 | 10µs | my ($target, $names) = @_; | ||
| 247 | 21 | 25µs | 21 | 38µs | my $stash = _getstash($target); # spent 38µs making 21 calls to Moo::_Utils::_getstash, avg 2µs/call |
| 248 | 21 | 20µs | my $exports = $EXPORTS{$target} | ||
| 249 | or return; | ||||
| 250 | |||||
| 251 | 17 | 7µs | $names = [keys %$exports] | ||
| 252 | if !$names; | ||||
| 253 | my %rev = | ||||
| 254 | map +($exports->{$_} => $_), | ||||
| 255 | 17 | 128µs | grep defined $exports->{$_}, | ||
| 256 | keys %$exports; | ||||
| 257 | |||||
| 258 | return | ||||
| 259 | grep { | ||||
| 260 | 65 | 119µs | my $g = $stash->{$_}; | ||
| 261 | 48 | 42µ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 | 100µs | 2 | 18µs | # spent 12µs (6+6) within Moo::_Utils::BEGIN@278 which was called:
# once (6µs+6µs) by Moo::BEGIN@6 at line 278 # spent 12µs making 1 call to Moo::_Utils::BEGIN@278
# spent 6µs making 1 call to strict::unimport |
| 279 | *$full_name = *{$old}{$type}; | ||||
| 280 | } | ||||
| 281 | } | ||||
| 282 | } | ||||
| 283 | |||||
| 284 | 1 | 7µs | 1 | 3µs | if ($Config::Config{useithreads}) { # spent 3µs making 1 call to Config::FETCH |
| 285 | require Moo::HandleMoose::_TypeMap; | ||||
| 286 | } | ||||
| 287 | |||||
| 288 | 1 | 5µ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 144µs within Moo::_Utils::CORE:subst which was called 55 times, avg 3µs/call:
# 27 times (84µs+0s) by Moo::_Utils::_set_loaded at line 222, avg 3µs/call
# 26 times (51µs+0s) by Moo::_Utils::_load_module at line 127, avg 2µs/call
# once (6µs+0s) by Moo::_Utils::_require at line 116
# once (3µs+0s) by Moo::_Utils::_maybe_load_module at line 155 |