Filename | /usr/share/perl5/Moo/_Utils.pm |
Statements | Executed 1150 statements in 5.20ms |
Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
---|---|---|---|---|---|
1 | 1 | 1 | 1.56ms | 1.67ms | BEGIN@12 | Moo::_Utils::
1 | 1 | 1 | 939µs | 1.94ms | _maybe_load_module | Moo::_Utils::
194 | 3 | 3 | 913µs | 2.35ms | _install_coderef | Moo::_Utils::
344 | 11 | 5 | 910µs | 910µs | _getglob | Moo::_Utils::
194 | 1 | 1 | 559µs | 962µs | _name_coderef | Moo::_Utils::
1 | 1 | 1 | 420µs | 587µs | BEGIN@16 | Moo::_Utils::
1 | 1 | 1 | 328µs | 1.57ms | BEGIN@14 | Moo::_Utils::
29 | 1 | 1 | 180µs | 68.8ms | _load_module (recurses: max depth 1, inclusive time 7.66ms) | Moo::_Utils::
25 | 2 | 2 | 98µs | 792µs | _set_loaded | Moo::_Utils::
25 | 2 | 2 | 67µs | 67µs | _getstash | Moo::_Utils::
4 | 1 | 1 | 54µs | 1.06ms | _install_modifier | Moo::_Utils::
1 | 1 | 1 | 14µs | 23µs | BEGIN@3 | Moo::_Utils::
1 | 1 | 1 | 12µs | 59µs | BEGIN@11 | Moo::_Utils::
1 | 1 | 1 | 11µs | 22µs | BEGIN@83 | Moo::_Utils::
2 | 1 | 1 | 10µs | 22µs | _get_linear_isa | Moo::_Utils::
1 | 1 | 1 | 10µs | 20µs | BEGIN@17 | Moo::_Utils::
1 | 1 | 1 | 10µs | 42µs | BEGIN@8 | Moo::_Utils::
1 | 1 | 1 | 9µs | 72µs | BEGIN@15 | Moo::_Utils::
1 | 1 | 1 | 9µs | 21µs | BEGIN@105 | Moo::_Utils::
1 | 1 | 1 | 8µs | 48µs | BEGIN@9 | Moo::_Utils::
1 | 1 | 1 | 4µs | 4µs | CORE:subst (opcode) | 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 | |||||
3 | 2 | 97µs | 2 | 32µs | # spent 23µs (14+9) within Moo::_Utils::BEGIN@3 which was called:
# once (14µs+9µs) by Moo::BEGIN@4 at line 3 # spent 23µs making 1 call to Moo::_Utils::BEGIN@3
# spent 9µs making 1 call to warnings::unimport |
4 | |||||
5 | 344 | 1.25ms | # spent 910µs within Moo::_Utils::_getglob which was called 344 times, avg 3µs/call:
# 194 times (478µs+0s) by Moo::_Utils::_install_coderef at line 84, avg 2µs/call
# 62 times (208µs+0s) by Method::Generate::Accessor::generate_method at line 108 of Method/Generate/Accessor.pm, avg 3µs/call
# 18 times (57µs+0s) by Sub::Defer::undefer_sub at line 25 of Sub/Defer.pm, avg 3µs/call
# 18 times (54µs+0s) by Method::Generate::Accessor::generate_method at line 204 of Method/Generate/Accessor.pm, avg 3µs/call
# 18 times (25µs+0s) by Sub::Defer::undefer_sub at line 30 of Sub/Defer.pm, avg 1µs/call
# 14 times (32µs+0s) by Moo::Role::import at line 73 of Moo/Role.pm, avg 2µs/call
# 12 times (38µs+0s) by Method::Generate::Accessor::generate_method at line 125 of Method/Generate/Accessor.pm, avg 3µs/call
# 4 times (8µs+0s) by Method::Generate::BuildAll::buildall_body_for at line 27 of Method/Generate/BuildAll.pm, avg 2µs/call
# 2 times (5µs+0s) by Method::Generate::Accessor::generate_method at line 145 of Method/Generate/Accessor.pm, avg 3µs/call
# once (3µs+0s) by Method::Generate::Accessor::generate_method at line 164 of Method/Generate/Accessor.pm
# once (2µs+0s) by Method::Generate::Accessor::generate_method at line 181 of Method/Generate/Accessor.pm | ||
6 | 25 | 91µs | # spent 67µs within Moo::_Utils::_getstash which was called 25 times, avg 3µs/call:
# 14 times (44µs+0s) by Moo::Role::import at line 35 of Moo/Role.pm, avg 3µs/call
# 11 times (23µs+0s) by Moo::import at line 70 of Moo.pm, avg 2µs/call | ||
7 | |||||
8 | 2 | 42µs | 2 | 75µs | # spent 42µs (10+32) within Moo::_Utils::BEGIN@8 which was called:
# once (10µs+32µs) by Moo::BEGIN@4 at line 8 # spent 42µs making 1 call to Moo::_Utils::BEGIN@8
# spent 32µs making 1 call to constant::import |
9 | 3 | 36µs | 2 | 88µs | # spent 48µs (8+40) within Moo::_Utils::BEGIN@9 which was called:
# once (8µs+40µs) by Moo::BEGIN@4 at line 9 # spent 48µs making 1 call to Moo::_Utils::BEGIN@9
# spent 40µs making 1 call to constant::import |
10 | |||||
11 | 3 | 38µs | 3 | 106µs | # spent 59µs (12+47) within Moo::_Utils::BEGIN@11 which was called:
# once (12µs+47µs) by Moo::BEGIN@4 at line 11 # spent 59µs making 1 call to Moo::_Utils::BEGIN@11
# spent 33µs making 1 call to strictures::import
# spent 14µs making 1 call to strictures::VERSION |
12 | 2 | 193µs | 2 | 1.70ms | # spent 1.67ms (1.56+114µs) within Moo::_Utils::BEGIN@12 which was called:
# once (1.56ms+114µs) by Moo::BEGIN@4 at line 12 # spent 1.67ms making 1 call to Moo::_Utils::BEGIN@12
# spent 23µs making 1 call to Module::Runtime::import |
13 | |||||
14 | 2 | 115µs | 1 | 1.57ms | # spent 1.57ms (328µs+1.24) within Moo::_Utils::BEGIN@14 which was called:
# once (328µs+1.24ms) by Moo::BEGIN@4 at line 14 # spent 1.57ms making 1 call to Moo::_Utils::BEGIN@14 |
15 | 2 | 31µs | 2 | 135µs | # spent 72µs (9+63) within Moo::_Utils::BEGIN@15 which was called:
# once (9µs+63µs) by Moo::BEGIN@4 at line 15 # spent 72µs making 1 call to Moo::_Utils::BEGIN@15
# spent 63µs making 1 call to base::import |
16 | 2 | 126µs | 1 | 587µs | # spent 587µs (420+167) within Moo::_Utils::BEGIN@16 which was called:
# once (420µs+167µs) by Moo::BEGIN@4 at line 16 # spent 587µs making 1 call to Moo::_Utils::BEGIN@16 |
17 | 2 | 495µs | 2 | 30µs | # spent 20µs (10+10) within Moo::_Utils::BEGIN@17 which was called:
# once (10µs+10µs) by Moo::BEGIN@4 at line 17 # spent 20µs making 1 call to Moo::_Utils::BEGIN@17
# spent 10µs making 1 call to Config::import |
18 | |||||
19 | 1 | 3µs | our @EXPORT = qw( | ||
20 | _getglob _install_modifier _load_module _maybe_load_module | ||||
21 | _get_linear_isa _getstash _install_coderef _name_coderef | ||||
22 | _unimport_coderefs _in_global_destruction _set_loaded | ||||
23 | ); | ||||
24 | |||||
25 | sub _in_global_destruction (); | ||||
26 | 1 | 3µs | *_in_global_destruction = \&Devel::GlobalDestruction::in_global_destruction; | ||
27 | |||||
28 | # spent 1.06ms (54µs+1.00) within Moo::_Utils::_install_modifier which was called 4 times, avg 264µs/call:
# 4 times (54µs+1.00ms) by Moo::Role::_install_single_modifier at line 340 of Moo/Role.pm, avg 264µs/call | ||||
29 | 4 | 2µs | my ($into, $type, $name, $code) = @_; | ||
30 | |||||
31 | 4 | 26µs | 4 | 8µs | if (my $to_modify = $into->can($name)) { # CMM will throw for us if not # spent 8µs making 4 calls to UNIVERSAL::can, avg 2µs/call |
32 | 4 | 2µs | require Sub::Defer; | ||
33 | 4 | 5µs | 4 | 305µs | Sub::Defer::undefer_sub($to_modify); # spent 305µs making 4 calls to Sub::Defer::undefer_sub, avg 76µs/call |
34 | } | ||||
35 | |||||
36 | 4 | 14µs | 4 | 688µs | Class::Method::Modifiers::install_modifier(@_); # spent 688µs making 4 calls to Class::Method::Modifiers::install_modifier, avg 172µs/call |
37 | } | ||||
38 | |||||
39 | 1 | 100ns | our %MAYBE_LOADED; | ||
40 | |||||
41 | # spent 68.8ms (180µs+68.6) within Moo::_Utils::_load_module which was called 29 times, avg 2.37ms/call:
# 29 times (180µs+68.6ms) by Moo::Role::_inhale_if_moose at line 116 of Moo/Role.pm, avg 2.37ms/call | ||||
42 | 29 | 10µs | my $module = $_[0]; | ||
43 | 29 | 34µs | 29 | 768µs | my $file = module_notional_filename($module); # spent 768µs making 29 calls to Module::Runtime::module_notional_filename, avg 26µs/call |
44 | 29 | 38µs | 29 | 68.0ms | use_package_optimistically($module); # spent 75.5ms making 29 calls to Module::Runtime::use_package_optimistically, avg 2.60ms/call, recursion: max depth 1, sum of overlapping time 7.47ms |
45 | 29 | 71µs | return 1 | ||
46 | if $INC{$file}; | ||||
47 | my $error = $@ || "Can't locate $file"; | ||||
48 | |||||
49 | # can't just ->can('can') because a sub-package Foo::Bar::Baz | ||||
50 | # creates a 'Baz::' key in Foo::Bar's symbol table | ||||
51 | my $stash = _getstash($module)||{}; | ||||
52 | return 1 if grep +(!ref($_) and *$_{CODE}), values %$stash; | ||||
53 | return 1 | ||||
54 | if $INC{"Moose.pm"} && Class::MOP::class_of($module) | ||||
55 | or Mouse::Util->can('find_meta') && Mouse::Util::find_meta($module); | ||||
56 | die $error; | ||||
57 | } | ||||
58 | |||||
59 | # spent 1.94ms (939µs+1.00) within Moo::_Utils::_maybe_load_module which was called:
# once (939µs+1.00ms) by Method::Generate::Accessor::BEGIN@11 at line 17 of Method/Generate/Accessor.pm | ||||
60 | 1 | 700ns | return $MAYBE_LOADED{$_[0]} if exists $MAYBE_LOADED{$_[0]}; | ||
61 | 1 | 11µs | 1 | 4µs | (my $proto = $_[0]) =~ s/::/\//g; # spent 4µs making 1 call to Moo::_Utils::CORE:subst |
62 | 1 | 1µs | local $@; | ||
63 | 3 | 91µs | if (eval { require "${proto}.pm"; 1 }) { | ||
64 | $MAYBE_LOADED{$_[0]} = 1; | ||||
65 | } else { | ||||
66 | if (exists $INC{"${proto}.pm"}) { | ||||
67 | warn "$_[0] exists but failed to load with error: $@"; | ||||
68 | } | ||||
69 | $MAYBE_LOADED{$_[0]} = 0; | ||||
70 | } | ||||
71 | 1 | 6µs | return $MAYBE_LOADED{$_[0]}; | ||
72 | } | ||||
73 | |||||
74 | # spent 792µs (98+694) within Moo::_Utils::_set_loaded which was called 25 times, avg 32µs/call:
# 14 times (50µs+368µs) by Moo::Role::import at line 28 of Moo/Role.pm, avg 30µs/call
# 11 times (48µs+326µs) by Moo::import at line 25 of Moo.pm, avg 34µs/call | ||||
75 | 25 | 92µs | 25 | 694µs | $INC{Module::Runtime::module_notional_filename($_[0])} ||= $_[1]; # spent 694µs making 25 calls to Module::Runtime::module_notional_filename, avg 28µs/call |
76 | } | ||||
77 | |||||
78 | # spent 22µs (10+11) within Moo::_Utils::_get_linear_isa which was called 2 times, avg 11µs/call:
# 2 times (10µs+11µs) by Method::Generate::BuildAll::buildall_body_for at line 30 of Method/Generate/BuildAll.pm, avg 11µs/call | ||||
79 | 2 | 24µs | 2 | 11µs | return mro::get_linear_isa($_[0]); # spent 11µs making 2 calls to mro::get_linear_isa, avg 6µs/call |
80 | } | ||||
81 | |||||
82 | # spent 2.35ms (913µs+1.44) within Moo::_Utils::_install_coderef which was called 194 times, avg 12µs/call:
# 84 times (375µs+618µs) by Moo::Role::_install_tracked at line 22 of Moo/Role.pm, avg 12µs/call
# 66 times (305µs+478µs) by Moo::_install_tracked at line 19 of Moo.pm, avg 12µs/call
# 44 times (233µs+344µs) by Sub::Defer::defer_sub at line 57 of Sub/Defer.pm, avg 13µs/call | ||||
83 | 2 | 220µs | 2 | 33µs | # spent 22µs (11+11) within Moo::_Utils::BEGIN@83 which was called:
# once (11µs+11µs) by Moo::BEGIN@4 at line 83 # spent 22µs making 1 call to Moo::_Utils::BEGIN@83
# spent 11µs making 1 call to warnings::unimport |
84 | 194 | 712µs | 388 | 1.44ms | *{_getglob($_[0])} = _name_coderef(@_); # spent 962µs making 194 calls to Moo::_Utils::_name_coderef, avg 5µs/call
# spent 478µs making 194 calls to Moo::_Utils::_getglob, avg 2µs/call |
85 | } | ||||
86 | |||||
87 | # spent 962µs (559+403) within Moo::_Utils::_name_coderef which was called 194 times, avg 5µs/call:
# 194 times (559µs+403µs) by Moo::_Utils::_install_coderef at line 84, avg 5µs/call | ||||
88 | 194 | 56µs | shift if @_ > 2; # three args is (target, name, sub) | ||
89 | 194 | 1.08ms | 194 | 403µs | can_haz_subname ? Sub::Name::subname(@_) : $_[1]; # spent 403µs making 194 calls to Sub::Name::subname, avg 2µs/call |
90 | } | ||||
91 | |||||
92 | sub _unimport_coderefs { | ||||
93 | my ($target, $info) = @_; | ||||
94 | return unless $info and my $exports = $info->{exports}; | ||||
95 | my %rev = reverse %$exports; | ||||
96 | my $stash = _getstash($target); | ||||
97 | foreach my $name (keys %$exports) { | ||||
98 | if ($stash->{$name} and defined(&{$stash->{$name}})) { | ||||
99 | if ($rev{$target->can($name)}) { | ||||
100 | my $old = delete $stash->{$name}; | ||||
101 | my $full_name = join('::',$target,$name); | ||||
102 | # Copy everything except the code slot back into place (e.g. $has) | ||||
103 | foreach my $type (qw(SCALAR HASH ARRAY IO)) { | ||||
104 | next unless defined(*{$old}{$type}); | ||||
105 | 2 | 97µs | 2 | 34µs | # spent 21µs (9+12) within Moo::_Utils::BEGIN@105 which was called:
# once (9µs+12µs) by Moo::BEGIN@4 at line 105 # spent 21µs making 1 call to Moo::_Utils::BEGIN@105
# spent 12µs making 1 call to strict::unimport |
106 | *$full_name = *{$old}{$type}; | ||||
107 | } | ||||
108 | } | ||||
109 | } | ||||
110 | } | ||||
111 | } | ||||
112 | |||||
113 | 1 | 90µs | 1 | 4µs | if ($Config{useithreads}) { # spent 4µs making 1 call to Config::FETCH |
114 | require Moo::HandleMoose::_TypeMap; | ||||
115 | } | ||||
116 | |||||
117 | 1 | 5µs | 1; | ||
# spent 4µs within Moo::_Utils::CORE:subst which was called:
# once (4µs+0s) by Moo::_Utils::_maybe_load_module at line 61 |