| Filename | /Users/ether/.perlbrew/libs/36.0@std/lib/perl5/Moo.pm |
| Statements | Executed 2127 statements in 11.2ms |
| Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
|---|---|---|---|---|---|
| 116 | 4 | 3 | 5.88ms | 14.7ms | Moo::_accessor_maker_for |
| 99 | 4 | 3 | 2.69ms | 8.51ms | Moo::_constructor_maker_for (recurses: max depth 1, inclusive time 482µs) |
| 1 | 1 | 1 | 2.52ms | 17.1ms | Moo::BEGIN@6 |
| 17 | 1 | 1 | 2.05ms | 2.23ms | Moo::make_class |
| 45 | 6 | 6 | 1.08ms | 88.8ms | Moo::has |
| 17 | 1 | 1 | 834µs | 834µs | Moo::CORE:sort (opcode) |
| 17 | 1 | 1 | 456µs | 3.46ms | Moo::_install_subs |
| 17 | 17 | 17 | 358µs | 6.62ms | Moo::import |
| 17 | 1 | 1 | 260µs | 260µs | Moo::_gen_subs |
| 2 | 1 | 1 | 171µs | 2.41ms | Moo::_set_superclasses |
| 60 | 3 | 1 | 156µs | 156µs | Moo::_maybe_reset_handlemoose |
| 9 | 9 | 9 | 94µs | 7.85ms | Moo::with |
| 292 | 1 | 1 | 51µs | 51µs | Moo::CORE:match (opcode) |
| 1 | 1 | 1 | 40µs | 46µs | Moo::BEGIN@2 |
| 2 | 2 | 2 | 30µs | 2.44ms | Moo::extends |
| 5 | 5 | 3 | 22µs | 1.15ms | Moo::around |
| 7 | 1 | 1 | 20µs | 20µs | Moo::is_class |
| 1 | 1 | 1 | 15µs | 19µs | Moo::BEGIN@180 |
| 2 | 2 | 1 | 10µs | 513µs | Moo::before |
| 1 | 1 | 1 | 9µs | 12µs | Moo::BEGIN@230 |
| 1 | 1 | 1 | 8µs | 13µs | Moo::BEGIN@70 |
| 1 | 1 | 1 | 8µs | 10µs | Moo::__ANON__[:256] |
| 1 | 1 | 1 | 7µs | 22µs | Moo::BEGIN@18 |
| 1 | 1 | 1 | 5µs | 9µs | Moo::BEGIN@275 |
| 1 | 1 | 1 | 4µs | 4µs | Moo::BEGIN@19 |
| 1 | 1 | 1 | 4µs | 29µs | Moo::BEGIN@4 |
| 1 | 1 | 1 | 3µs | 22µs | Moo::BEGIN@3 |
| 0 | 0 | 0 | 0s | 0s | Moo::__ANON__[:101] |
| 0 | 0 | 0 | 0s | 0s | Moo::__ANON__[:106] |
| 0 | 0 | 0 | 0s | 0s | Moo::__ANON__[:126] |
| 0 | 0 | 0 | 0s | 0s | Moo::__ANON__[:133] |
| 0 | 0 | 0 | 0s | 0s | Moo::__ANON__[:248] |
| 0 | 0 | 0 | 0s | 0s | Moo::_concrete_methods_of |
| 0 | 0 | 0 | 0s | 0s | Moo::after |
| 0 | 0 | 0 | 0s | 0s | Moo::unimport |
| Line | State ments |
Time on line |
Calls | Time in subs |
Code |
|---|---|---|---|---|---|
| 1 | package Moo; | ||||
| 2 | 2 | 45µs | 2 | 52µs | # spent 46µs (40+6) within Moo::BEGIN@2 which was called:
# once (40µs+6µs) by OpenAPI::Modern::BEGIN@11 at line 2 # spent 46µs making 1 call to Moo::BEGIN@2
# spent 6µs making 1 call to strict::import |
| 3 | 2 | 16µs | 2 | 41µs | # spent 22µs (3+19) within Moo::BEGIN@3 which was called:
# once (3µs+19µs) by OpenAPI::Modern::BEGIN@11 at line 3 # spent 22µs making 1 call to Moo::BEGIN@3
# spent 19µs making 1 call to warnings::import |
| 4 | 2 | 28µs | 2 | 54µs | # spent 29µs (4+25) within Moo::BEGIN@4 which was called:
# once (4µs+25µs) by OpenAPI::Modern::BEGIN@11 at line 4 # spent 29µs making 1 call to Moo::BEGIN@4
# spent 25µs making 1 call to warnings::unimport |
| 5 | |||||
| 6 | 1 | 439µs | # spent 17.1ms (2.52+14.6) within Moo::BEGIN@6 which was called:
# once (2.52ms+14.6ms) by OpenAPI::Modern::BEGIN@11 at line 17 | ||
| 7 | _check_tracked | ||||
| 8 | _getglob | ||||
| 9 | _getstash | ||||
| 10 | _install_coderef | ||||
| 11 | _install_modifier | ||||
| 12 | _install_tracked | ||||
| 13 | _linear_isa | ||||
| 14 | _load_module | ||||
| 15 | _set_loaded | ||||
| 16 | _unimport_coderefs | ||||
| 17 | 1 | 49µs | 2 | 17.2ms | ); # spent 17.1ms making 1 call to Moo::BEGIN@6
# spent 104µs making 1 call to Exporter::import |
| 18 | 2 | 43µs | 2 | 37µs | # spent 22µs (7+15) within Moo::BEGIN@18 which was called:
# once (7µs+15µs) by OpenAPI::Modern::BEGIN@11 at line 18 # spent 22µs making 1 call to Moo::BEGIN@18
# spent 15µs making 1 call to Exporter::import |
| 19 | # spent 4µs within Moo::BEGIN@19 which was called:
# once (4µs+0s) by OpenAPI::Modern::BEGIN@11 at line 27 | ||||
| 20 | 1 | 3µs | our @CARP_NOT = qw( | ||
| 21 | Method::Generate::Constructor | ||||
| 22 | Method::Generate::Accessor | ||||
| 23 | Moo::sification | ||||
| 24 | Moo::_Utils | ||||
| 25 | Moo::Role | ||||
| 26 | ); | ||||
| 27 | 1 | 241µs | 1 | 4µs | } # spent 4µs making 1 call to Moo::BEGIN@19 |
| 28 | |||||
| 29 | 1 | 0s | our $VERSION = '2.005004'; | ||
| 30 | 1 | 1µs | $VERSION =~ tr/_//d; | ||
| 31 | |||||
| 32 | 1 | 1.29ms | require Moo::sification; | ||
| 33 | 1 | 3µs | 1 | 3µs | Moo::sification->import; # spent 3µs making 1 call to Moo::sification::import |
| 34 | |||||
| 35 | our %MAKERS; | ||||
| 36 | |||||
| 37 | # spent 6.62ms (358µs+6.26) within Moo::import which was called 17 times, avg 389µs/call:
# once (22µs+2.25ms) by OpenAPI::Modern::BEGIN@11 at line 11 of OpenAPI/Modern.pm
# once (20µs+320µs) by JSON::Schema::Modern::BEGIN@11 at line 11 of JSON/Schema/Modern.pm
# once (19µs+318µs) by JSON::Schema::Modern::Vocabulary::OpenAPI::BEGIN@10 at line 10 of JSON/Schema/Modern/Vocabulary/OpenAPI.pm
# once (23µs+308µs) by JSON::Schema::Modern::Document::OpenAPI::BEGIN@11 at line 11 of JSON/Schema/Modern/Document/OpenAPI.pm
# once (21µs+276µs) by JSON::Schema::Modern::Annotation::BEGIN@10 at line 10 of JSON/Schema/Modern/Annotation.pm
# once (20µs+275µs) by JSON::Schema::Modern::Vocabulary::Applicator::BEGIN@10 at line 10 of JSON/Schema/Modern/Vocabulary/Applicator.pm
# once (19µs+274µs) by Method::Generate::Constructor::BEGIN@12 at line 15 of Method/Generate/Constructor.pm
# once (21µs+266µs) by JSON::Schema::Modern::Vocabulary::MetaData::BEGIN@10 at line 10 of JSON/Schema/Modern/Vocabulary/MetaData.pm
# once (21µs+257µs) by JSON::Schema::Modern::Document::BEGIN@10 at line 10 of JSON/Schema/Modern/Document.pm
# once (28µs+244µs) by JSON::Schema::Modern::Error::BEGIN@10 at line 10 of JSON/Schema/Modern/Error.pm
# once (25µs+246µs) by JSON::Schema::Modern::Vocabulary::FormatAnnotation::BEGIN@10 at line 10 of JSON/Schema/Modern/Vocabulary/FormatAnnotation.pm
# once (24µs+246µs) by JSON::Schema::Modern::Vocabulary::Core::BEGIN@10 at line 10 of JSON/Schema/Modern/Vocabulary/Core.pm
# once (20µs+245µs) by JSON::Schema::Modern::Result::BEGIN@10 at line 10 of JSON/Schema/Modern/Result.pm
# once (25µs+229µs) by JSON::Schema::Modern::Vocabulary::Content::BEGIN@10 at line 10 of JSON/Schema/Modern/Vocabulary/Content.pm
# once (19µs+177µs) by JSON::Schema::Modern::Vocabulary::Unevaluated::BEGIN@10 at line 10 of JSON/Schema/Modern/Vocabulary/Unevaluated.pm
# once (15µs+165µs) by JSON::Schema::Modern::Vocabulary::Validation::BEGIN@10 at line 10 of JSON/Schema/Modern/Vocabulary/Validation.pm
# once (16µs+159µs) by JSON::Schema::Modern::Vocabulary::FormatAssertion::BEGIN@10 at line 10 of JSON/Schema/Modern/Vocabulary/FormatAssertion.pm | ||||
| 38 | 17 | 14µs | my $target = caller; | ||
| 39 | 17 | 6µs | my $class = shift; | ||
| 40 | 17 | 46µs | 15 | 42µs | if ($INC{'Role/Tiny.pm'} and Role::Tiny->is_role($target)) { # spent 42µs making 15 calls to Role::Tiny::is_role, avg 3µs/call |
| 41 | croak "Cannot import Moo into a role"; | ||||
| 42 | } | ||||
| 43 | |||||
| 44 | 17 | 53µs | 17 | 168µs | _set_loaded(caller); # spent 168µs making 17 calls to Moo::_Utils::_set_loaded, avg 10µs/call |
| 45 | |||||
| 46 | 17 | 65µs | 17 | 24µs | strict->import; # spent 24µs making 17 calls to strict::import, avg 1µs/call |
| 47 | 17 | 16µs | 17 | 338µs | warnings->import; # spent 338µs making 17 calls to warnings::import, avg 20µs/call |
| 48 | |||||
| 49 | 17 | 40µs | 17 | 3.46ms | $class->_install_subs($target, @_); # spent 3.46ms making 17 calls to Moo::_install_subs, avg 203µs/call |
| 50 | 17 | 34µs | 17 | 2.23ms | $class->make_class($target); # spent 2.23ms making 17 calls to Moo::make_class, avg 131µs/call |
| 51 | 17 | 145µs | return; | ||
| 52 | } | ||||
| 53 | |||||
| 54 | # spent 2.23ms (2.05+178µs) within Moo::make_class which was called 17 times, avg 131µs/call:
# 17 times (2.05ms+178µs) by Moo::import at line 50, avg 131µs/call | ||||
| 55 | 17 | 11µs | my ($me, $target) = @_; | ||
| 56 | |||||
| 57 | 17 | 21µs | my $makers = $MAKERS{$target} ||= {}; | ||
| 58 | 17 | 6µs | return $target if $makers->{is_class}; | ||
| 59 | |||||
| 60 | 17 | 51µs | 17 | 33µs | my $stash = _getstash($target); # spent 33µs making 17 calls to Moo::_Utils::_getstash, avg 2µs/call |
| 61 | $makers->{non_methods} = { | ||||
| 62 | map +($_ => \&{"${target}::${_}"}), | ||||
| 63 | 17 | 658µs | 292 | 51µs | grep exists &{"${target}::${_}"}, # spent 51µs making 292 calls to Moo::CORE:match, avg 175ns/call |
| 64 | grep !/::\z/ && !/\A\(/, | ||||
| 65 | keys %$stash | ||||
| 66 | }; | ||||
| 67 | |||||
| 68 | 17 | 13µs | $makers->{is_class} = 1; | ||
| 69 | { | ||||
| 70 | 19 | 716µs | 2 | 18µs | # spent 13µs (8+5) within Moo::BEGIN@70 which was called:
# once (8µs+5µs) by OpenAPI::Modern::BEGIN@11 at line 70 # spent 13µs making 1 call to Moo::BEGIN@70
# spent 5µs making 1 call to strict::unimport |
| 71 | @{"${target}::ISA"} = do { | ||||
| 72 | 34 | 538µs | require Moo::Object; ('Moo::Object'); | ||
| 73 | 17 | 268µs | } unless @{"${target}::ISA"}; | ||
| 74 | } | ||||
| 75 | 17 | 9µs | if ($INC{'Moo/HandleMoose.pm'} && !$Moo::sification::disabled) { | ||
| 76 | Moo::HandleMoose::inject_fake_metaclass_for($target); | ||||
| 77 | } | ||||
| 78 | 17 | 44µs | return $target; | ||
| 79 | } | ||||
| 80 | |||||
| 81 | # spent 20µs within Moo::is_class which was called 7 times, avg 3µs/call:
# 7 times (20µs+0s) by MooX::TypeTiny::import at line 14 of MooX/TypeTiny.pm, avg 3µs/call | ||||
| 82 | 7 | 5µs | my ($me, $class) = @_; | ||
| 83 | 7 | 30µs | return $MAKERS{$class} && $MAKERS{$class}{is_class}; | ||
| 84 | } | ||||
| 85 | |||||
| 86 | # spent 3.46ms (456µs+3.00) within Moo::_install_subs which was called 17 times, avg 203µs/call:
# 17 times (456µs+3.00ms) by Moo::import at line 49, avg 203µs/call | ||||
| 87 | 17 | 13µs | my ($me, $target) = @_; | ||
| 88 | 17 | 80µs | 17 | 260µs | my %install = $me->_gen_subs($target); # spent 260µs making 17 calls to Moo::_gen_subs, avg 15µs/call |
| 89 | _install_tracked $target => $_ => $install{$_} | ||||
| 90 | 17 | 1.04ms | 119 | 2.74ms | for sort keys %install; # spent 1.91ms making 102 calls to Moo::_Utils::_install_tracked, avg 19µs/call
# spent 834µs making 17 calls to Moo::CORE:sort, avg 49µs/call |
| 91 | 17 | 48µs | return; | ||
| 92 | } | ||||
| 93 | |||||
| 94 | # spent 260µs within Moo::_gen_subs which was called 17 times, avg 15µs/call:
# 17 times (260µs+0s) by Moo::_install_subs at line 88, avg 15µs/call | ||||
| 95 | 17 | 11µs | my ($me, $target) = @_; | ||
| 96 | return ( | ||||
| 97 | # spent 2.44ms (30µs+2.41) within Moo::extends which was called 2 times, avg 1.22ms/call:
# once (7µs+1.73ms) by JSON::Schema::Modern::Document::extends at line 6 of (eval 258)[Class/Method/Modifiers.pm:148]
# once (23µs+682µs) by JSON::Schema::Modern::Document::OpenAPI::extends at line 6 of (eval 382)[Class/Method/Modifiers.pm:148] | ||||
| 98 | 2 | 4µs | 2 | 2.41ms | $me->_set_superclasses($target, @_); # spent 2.41ms making 2 calls to Moo::_set_superclasses, avg 1.20ms/call |
| 99 | 2 | 5µs | 2 | 5µs | $me->_maybe_reset_handlemoose($target); # spent 5µs making 2 calls to Moo::_maybe_reset_handlemoose, avg 2µs/call |
| 100 | 2 | 8µs | return; | ||
| 101 | }, | ||||
| 102 | # spent 7.85ms (94µs+7.76) within Moo::with which was called 9 times, avg 872µs/call:
# once (18µs+4.16ms) by Module::Runtime::require_module at line 20 of JSON/Schema/Modern/Vocabulary/Core.pm
# once (13µs+526µs) by Module::Runtime::require_module at line 21 of JSON/Schema/Modern/Vocabulary/FormatAssertion.pm
# once (11µs+501µs) by Module::Runtime::require_module at line 22 of JSON/Schema/Modern/Vocabulary/Content.pm
# once (9µs+502µs) by JSON::Schema::Modern::Vocabulary::Applicator::BEGIN@21 at line 21 of JSON/Schema/Modern/Vocabulary/Unevaluated.pm
# once (9µs+479µs) by Module::Runtime::require_module at line 21 of JSON/Schema/Modern/Vocabulary/FormatAnnotation.pm
# once (10µs+476µs) by Module::Runtime::require_module at line 20 of JSON/Schema/Modern/Vocabulary/OpenAPI.pm
# once (10µs+447µs) by Module::Runtime::require_module at line 23 of JSON/Schema/Modern/Vocabulary/Validation.pm
# once (7µs+345µs) by Module::Runtime::require_module at line 24 of JSON/Schema/Modern/Vocabulary/Applicator.pm
# once (7µs+316µs) by Module::Runtime::require_module at line 20 of JSON/Schema/Modern/Vocabulary/MetaData.pm | ||||
| 103 | 9 | 10µs | require Moo::Role; | ||
| 104 | 9 | 36µs | 9 | 7.74ms | Moo::Role->apply_roles_to_package($target, @_); # spent 7.74ms making 9 calls to Role::Tiny::apply_roles_to_package, avg 860µs/call |
| 105 | 9 | 46µs | 9 | 17µs | $me->_maybe_reset_handlemoose($target); # spent 17µs making 9 calls to Moo::_maybe_reset_handlemoose, avg 2µs/call |
| 106 | }, | ||||
| 107 | # spent 88.8ms (1.08+87.7) within Moo::has which was called 45 times, avg 1.97ms/call:
# 16 times (333µs+38.9ms) by JSON::Schema::Modern::has at line 6 of (eval 33)[Class/Method/Modifiers.pm:148], avg 2.45ms/call
# 8 times (181µs+22.2ms) by JSON::Schema::Modern::Document::has at line 6 of (eval 256)[Class/Method/Modifiers.pm:148], avg 2.80ms/call
# 6 times (162µs+9.54ms) by MooX::HandlesVia::has at line 31 of MooX/HandlesVia.pm, avg 1.62ms/call
# 6 times (146µs+8.81ms) by JSON::Schema::Modern::Result::has at line 6 of (eval 219)[Class/Method/Modifiers.pm:148], avg 1.49ms/call
# 5 times (152µs+5.19ms) by JSON::Schema::Modern::Error::has at line 6 of (eval 192)[Class/Method/Modifiers.pm:148], avg 1.07ms/call
# 4 times (102µs+3.04ms) by JSON::Schema::Modern::Annotation::has at line 6 of (eval 225)[Class/Method/Modifiers.pm:148], avg 784µs/call | ||||
| 108 | 45 | 18µs | my $name_proto = shift; | ||
| 109 | 45 | 56µs | my @name_proto = ref $name_proto eq 'ARRAY' ? @$name_proto : $name_proto; | ||
| 110 | 45 | 40µs | if (@_ % 2 != 0) { | ||
| 111 | croak "Invalid options for " . join(', ', map "'$_'", @name_proto) | ||||
| 112 | . " attribute(s): even number of arguments expected, got " . scalar @_; | ||||
| 113 | } | ||||
| 114 | 45 | 64µs | my %spec = @_; | ||
| 115 | 45 | 27µs | foreach my $name (@name_proto) { | ||
| 116 | # Note that when multiple attributes specified, each attribute | ||||
| 117 | # needs a separate \%specs hashref | ||||
| 118 | 49 | 55µs | my $spec_ref = @name_proto > 1 ? +{%spec} : \%spec; | ||
| 119 | 49 | 124µs | 98 | 1.70ms | $me->_constructor_maker_for($target) # spent 1.62ms making 49 calls to Method::Generate::Constructor::register_attribute_specs, avg 33µs/call
# spent 72µs making 49 calls to Moo::_constructor_maker_for, avg 1µs/call |
| 120 | ->register_attribute_specs($name, $spec_ref); | ||||
| 121 | 49 | 153µs | 98 | 85.9ms | $me->_accessor_maker_for($target) # spent 85.8ms making 49 calls to Method::Generate::Accessor::generate_method, avg 1.75ms/call
# spent 54µs making 49 calls to Moo::_accessor_maker_for, avg 1µs/call |
| 122 | ->generate_method($target, $name, $spec_ref); | ||||
| 123 | 49 | 161µs | 49 | 134µs | $me->_maybe_reset_handlemoose($target); # spent 134µs making 49 calls to Moo::_maybe_reset_handlemoose, avg 3µs/call |
| 124 | } | ||||
| 125 | 45 | 155µs | return; | ||
| 126 | }, | ||||
| 127 | (map { | ||||
| 128 | 68 | 217µs | my $type = $_; | ||
| 129 | ( | ||||
| 130 | # spent 513µs (10+503) within Moo::before which was called 2 times, avg 256µs/call:
# once (4µs+308µs) by OpenAPI::Modern::BEGIN@26 at line 909 of JSON/Schema/Modern.pm
# once (6µs+195µs) by OpenAPI::Modern::BEGIN@26 at line 124 of JSON/Schema/Modern.pm
# spent 1.15ms (22µs+1.12) within Moo::around which was called 5 times, avg 229µs/call:
# once (4µs+266µs) by JSON::Schema::Modern::BEGIN@35 at line 135 of JSON/Schema/Modern/Document.pm
# once (6µs+238µs) by OpenAPI::Modern::BEGIN@26 at line 907 of JSON/Schema/Modern.pm
# once (6µs+219µs) by main::BEGIN@2 at line 79 of OpenAPI/Modern.pm
# once (4µs+215µs) by OpenAPI::Modern::BEGIN@26 at line 133 of JSON/Schema/Modern.pm
# once (2µs+187µs) by OpenAPI::Modern::BEGIN@26 at line 646 of JSON/Schema/Modern.pm | ||||
| 131 | 7 | 15µs | 7 | 1.63ms | _install_modifier($target, $type, @_); # spent 1.63ms making 7 calls to Moo::_Utils::_install_modifier, avg 233µs/call |
| 132 | 7 | 23µs | return; | ||
| 133 | }, | ||||
| 134 | ) | ||||
| 135 | 51 | 46µs | } qw(before after around)), | ||
| 136 | ); | ||||
| 137 | } | ||||
| 138 | |||||
| 139 | sub unimport { | ||||
| 140 | my $target = caller; | ||||
| 141 | _unimport_coderefs($target); | ||||
| 142 | } | ||||
| 143 | |||||
| 144 | # spent 2.41ms (171µs+2.23) within Moo::_set_superclasses which was called 2 times, avg 1.20ms/call:
# 2 times (171µs+2.23ms) by Moo::extends at line 98, avg 1.20ms/call | ||||
| 145 | 2 | 2µs | my $class = shift; | ||
| 146 | 2 | 0s | my $target = shift; | ||
| 147 | 2 | 3µs | foreach my $superclass (@_) { | ||
| 148 | 2 | 3µs | 2 | 1.44ms | _load_module($superclass); # spent 1.44ms making 2 calls to Moo::_Utils::_load_module, avg 718µs/call |
| 149 | 2 | 10µs | 2 | 6µs | if ($INC{'Role/Tiny.pm'} && Role::Tiny->is_role($superclass)) { # spent 6µs making 2 calls to Role::Tiny::is_role, avg 3µs/call |
| 150 | croak "Can't extend role '$superclass'"; | ||||
| 151 | } | ||||
| 152 | } | ||||
| 153 | 2 | 29µs | 2 | 6µs | @{*{_getglob("${target}::ISA")}} = @_; # spent 6µs making 2 calls to Moo::_Utils::_getglob, avg 3µs/call |
| 154 | 2 | 2µs | if (my $old = delete $Moo::MAKERS{$target}{constructor}) { | ||
| 155 | 2 | 4µs | 2 | 19µs | $old->assert_constructor; # spent 19µs making 2 calls to Method::Generate::Constructor::assert_constructor, avg 10µs/call |
| 156 | 2 | 28µs | 2 | 4µs | delete _getstash($target)->{new}; # spent 4µs making 2 calls to Moo::_Utils::_getstash, avg 2µs/call |
| 157 | Moo->_constructor_maker_for($target) | ||||
| 158 | 2 | 11µs | 6 | 761µs | ->register_attribute_specs(%{$old->all_attribute_specs}); # spent 733µs making 2 calls to Moo::_constructor_maker_for, avg 366µs/call
# spent 27µs making 2 calls to Method::Generate::Constructor::register_attribute_specs, avg 14µs/call
# spent 1µs making 2 calls to Method::Generate::Constructor::all_attribute_specs, avg 500ns/call |
| 159 | } | ||||
| 160 | elsif (!$target->isa('Moo::Object')) { | ||||
| 161 | Moo->_constructor_maker_for($target); | ||||
| 162 | } | ||||
| 163 | 2 | 76µs | 2 | 3µs | $Moo::HandleMoose::MOUSE{$target} = [ # spent 3µs making 2 calls to UNIVERSAL::can, avg 2µs/call |
| 164 | grep defined, map Mouse::Util::find_meta($_), @_ | ||||
| 165 | ] if Mouse::Util->can('find_meta'); | ||||
| 166 | } | ||||
| 167 | |||||
| 168 | sub _maybe_reset_handlemoose { | ||||
| 169 | 60 | 25µs | my ($class, $target) = @_; | ||
| 170 | 60 | 210µs | if ($INC{'Moo/HandleMoose.pm'} && !$Moo::sification::disabled) { | ||
| 171 | Moo::HandleMoose::maybe_reinject_fake_metaclass_for($target); | ||||
| 172 | } | ||||
| 173 | } | ||||
| 174 | |||||
| 175 | # spent 14.7ms (5.88+8.79) within Moo::_accessor_maker_for which was called 116 times, avg 126µs/call:
# 49 times (54µs+0s) by Moo::has at line 121, avg 1µs/call
# 47 times (5.62ms+8.65ms) by MooX::TypeTiny::__ANON__[/Users/ether/.perlbrew/libs/36.0@std/lib/perl5/MooX/TypeTiny.pm:25] at line 19 of MooX/TypeTiny.pm, avg 304µs/call
# 10 times (164µs+127µs) by Moo::Role::_maybe_make_accessors at line 254 of Moo/Role.pm, avg 29µs/call
# 10 times (40µs+20µs) by Moo::_constructor_maker_for at line 207, avg 6µs/call | ||||
| 176 | 116 | 45µs | my ($class, $target) = @_; | ||
| 177 | 116 | 54µs | return unless $MAKERS{$target}; | ||
| 178 | 116 | 322µs | $MAKERS{$target}{accessor} ||= do { | ||
| 179 | 18 | 12µs | my $maker_class = do { | ||
| 180 | 2 | 293µs | 2 | 23µs | # spent 19µs (15+4) within Moo::BEGIN@180 which was called:
# once (15µs+4µs) by OpenAPI::Modern::BEGIN@11 at line 180 # spent 19µs making 1 call to Moo::BEGIN@180
# spent 4µs making 1 call to strict::unimport |
| 181 | 18 | 14µs | if (my $m = do { | ||
| 182 | 18 | 121µs | 18 | 56µs | my @isa = @{_linear_isa($target)}; # spent 56µs making 18 calls to mro::get_linear_isa, avg 3µs/call |
| 183 | 18 | 6µs | shift @isa; | ||
| 184 | 18 | 74µs | if (my ($parent_new) = grep +(defined &{$_.'::new'}), @isa) { | ||
| 185 | $MAKERS{$parent_new} && $MAKERS{$parent_new}{accessor}; | ||||
| 186 | } | ||||
| 187 | else { | ||||
| 188 | undef; | ||||
| 189 | } | ||||
| 190 | }) { | ||||
| 191 | ref($m); | ||||
| 192 | } else { | ||||
| 193 | 18 | 830µs | require Method::Generate::Accessor; | ||
| 194 | 18 | 2µs | 'Method::Generate::Accessor' | ||
| 195 | } | ||||
| 196 | }; | ||||
| 197 | 18 | 54µs | 18 | 221µs | $maker_class->new; # spent 221µs making 18 calls to Moo::Object::new, avg 12µs/call |
| 198 | } | ||||
| 199 | } | ||||
| 200 | |||||
| 201 | # spent 8.51ms (2.69+5.81) within Moo::_constructor_maker_for which was called 99 times, avg 86µs/call:
# 49 times (72µs+0s) by Moo::has at line 119, avg 1µs/call
# 47 times (2.50ms+5.20ms) by MooX::TypeTiny::__ANON__[/Users/ether/.perlbrew/libs/36.0@std/lib/perl5/MooX/TypeTiny.pm:25] at line 24 of MooX/TypeTiny.pm, avg 164µs/call
# 2 times (76µs+657µs) by Moo::_set_superclasses at line 158, avg 366µs/call
# once (45µs+-45µs) by Moo::_constructor_maker_for at line 250 of Method/Generate/Constructor.pm | ||||
| 202 | 99 | 34µs | my ($class, $target) = @_; | ||
| 203 | 99 | 37µs | return unless $MAKERS{$target}; | ||
| 204 | 99 | 259µs | $MAKERS{$target}{constructor} ||= do { | ||
| 205 | 10 | 434µs | require Method::Generate::Constructor; | ||
| 206 | |||||
| 207 | 10 | 58µs | 10 | 60µs | my %construct_opts = ( # spent 60µs making 10 calls to Moo::_accessor_maker_for, avg 6µs/call |
| 208 | package => $target, | ||||
| 209 | accessor_generator => $class->_accessor_maker_for($target), | ||||
| 210 | subconstructor_handler => ( | ||||
| 211 | ' if ($Moo::MAKERS{$class}) {'."\n" | ||||
| 212 | .' if ($Moo::MAKERS{$class}{constructor}) {'."\n" | ||||
| 213 | .' package '.$target.';'."\n" | ||||
| 214 | .' return $invoker->SUPER::new(@_);'."\n" | ||||
| 215 | .' }'."\n" | ||||
| 216 | .' '.$class.'->_constructor_maker_for($class);'."\n" | ||||
| 217 | .' return $invoker->new(@_)'.";\n" | ||||
| 218 | .' } elsif ($INC{"Moose.pm"} and my $meta = Class::MOP::get_metaclass_by_name($class)) {'."\n" | ||||
| 219 | .' return $meta->new_object('."\n" | ||||
| 220 | .' $class->can("BUILDARGS") ? $class->BUILDARGS(@_)'."\n" | ||||
| 221 | .' : $class->Moo::Object::BUILDARGS(@_)'."\n" | ||||
| 222 | .' );'."\n" | ||||
| 223 | .' }'."\n" | ||||
| 224 | ), | ||||
| 225 | ); | ||||
| 226 | |||||
| 227 | 10 | 2µs | my $con; | ||
| 228 | 10 | 40µs | 10 | 10µs | my @isa = @{_linear_isa($target)}; # spent 10µs making 10 calls to mro::get_linear_isa, avg 1µs/call |
| 229 | 10 | 7µs | shift @isa; | ||
| 230 | 2 | 268µs | 2 | 15µs | # spent 12µs (9+3) within Moo::BEGIN@230 which was called:
# once (9µs+3µs) by OpenAPI::Modern::BEGIN@11 at line 230 # spent 12µs making 1 call to Moo::BEGIN@230
# spent 3µs making 1 call to strict::unimport |
| 231 | 10 | 29µs | if (my ($parent_new) = grep +(defined &{$_.'::new'}), @isa) { | ||
| 232 | 10 | 18µs | 1 | 1µs | if ($parent_new eq 'Moo::Object') { # spent 1µs making 1 call to UNIVERSAL::can |
| 233 | # no special constructor needed | ||||
| 234 | } | ||||
| 235 | elsif (my $makers = $MAKERS{$parent_new}) { | ||||
| 236 | 1 | 1µs | $con = $makers->{constructor}; | ||
| 237 | 1 | 3µs | 1 | 23µs | $construct_opts{construction_string} = $con->construction_string # spent 23µs making 1 call to Method::Generate::Constructor::construction_string |
| 238 | if $con; | ||||
| 239 | } | ||||
| 240 | elsif ($parent_new->can('BUILDALL')) { | ||||
| 241 | $construct_opts{construction_builder} = sub { | ||||
| 242 | my $inv = $target->can('BUILDARGS') ? '' : 'Moo::Object::'; | ||||
| 243 | 'do {' | ||||
| 244 | .' my $args = $class->'.$inv.'BUILDARGS(@_);' | ||||
| 245 | .' $args->{__no_BUILD__} = 1;' | ||||
| 246 | .' $invoker->'.$target.'::SUPER::new($args);' | ||||
| 247 | .'}' | ||||
| 248 | }; | ||||
| 249 | } | ||||
| 250 | else { | ||||
| 251 | # spent 10µs (8+2) within Moo::__ANON__[/Users/ether/.perlbrew/libs/36.0@std/lib/perl5/Moo.pm:256] which was called:
# once (8µs+2µs) by Method::Generate::Constructor::_build_construction_string at line 68 of Method/Generate/Constructor.pm | ||||
| 252 | 1 | 12µs | 1 | 2µs | '$invoker->'.$target.'::SUPER::new(' # spent 2µs making 1 call to UNIVERSAL::can |
| 253 | .($target->can('FOREIGNBUILDARGS') ? | ||||
| 254 | '$class->FOREIGNBUILDARGS(@_)' : '@_') | ||||
| 255 | .')' | ||||
| 256 | 1 | 1µs | }; | ||
| 257 | } | ||||
| 258 | } | ||||
| 259 | ($con ? ref($con) : 'Method::Generate::Constructor') | ||||
| 260 | ->new(%construct_opts) | ||||
| 261 | ->install_delayed | ||||
| 262 | 10 | 91µs | 31 | 4.63ms | ->register_attribute_specs(%{$con?$con->all_attribute_specs:{}}) # spent 2.75ms making 10 calls to Method::Generate::Constructor::install_delayed, avg 274µs/call
# spent 1.61ms making 10 calls to Method::Generate::Constructor::new, avg 162µs/call
# spent 272µs making 10 calls to Method::Generate::Constructor::register_attribute_specs, avg 27µs/call
# spent 3µs making 1 call to Method::Generate::Constructor::all_attribute_specs |
| 263 | } | ||||
| 264 | } | ||||
| 265 | |||||
| 266 | sub _concrete_methods_of { | ||||
| 267 | my ($me, $class) = @_; | ||||
| 268 | my $makers = $MAKERS{$class}; | ||||
| 269 | |||||
| 270 | my $non_methods = $makers->{non_methods} || {}; | ||||
| 271 | my $stash = _getstash($class); | ||||
| 272 | |||||
| 273 | my $subs = { | ||||
| 274 | map {; | ||||
| 275 | 2 | 252µs | 2 | 13µs | # spent 9µs (5+4) within Moo::BEGIN@275 which was called:
# once (5µs+4µs) by OpenAPI::Modern::BEGIN@11 at line 275 # spent 9µs making 1 call to Moo::BEGIN@275
# spent 4µs making 1 call to strict::unimport |
| 276 | ${"${class}::${_}"} = ${"${class}::${_}"}; | ||||
| 277 | ($_ => \&{"${class}::${_}"}); | ||||
| 278 | } | ||||
| 279 | grep exists &{"${class}::${_}"}, | ||||
| 280 | grep !/::\z/, | ||||
| 281 | keys %$stash | ||||
| 282 | }; | ||||
| 283 | |||||
| 284 | my %tracked = map +($_ => 1), _check_tracked($class, [ keys %$subs ]); | ||||
| 285 | |||||
| 286 | return { | ||||
| 287 | map +($_ => \&{"${class}::${_}"}), | ||||
| 288 | grep !($non_methods->{$_} && $non_methods->{$_} == $subs->{$_}), | ||||
| 289 | grep !exists $tracked{$_}, | ||||
| 290 | keys %$subs | ||||
| 291 | }; | ||||
| 292 | } | ||||
| 293 | |||||
| 294 | 1 | 6µs | 1; | ||
| 295 | __END__ | ||||
# spent 51µs within Moo::CORE:match which was called 292 times, avg 175ns/call:
# 292 times (51µs+0s) by Moo::make_class at line 63, avg 175ns/call | |||||
# spent 834µs within Moo::CORE:sort which was called 17 times, avg 49µs/call:
# 17 times (834µs+0s) by Moo::_install_subs at line 90, avg 49µs/call |