| Filename | /Users/ether/.perlbrew/libs/36.0@std/lib/perl5/Moo.pm |
| Statements | Executed 2129 statements in 7.71ms |
| Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
|---|---|---|---|---|---|
| 116 | 4 | 3 | 3.79ms | 9.83ms | Moo::_accessor_maker_for |
| 99 | 4 | 3 | 2.99ms | 8.42ms | Moo::_constructor_maker_for (recurses: max depth 1, inclusive time 581µs) |
| 1 | 1 | 1 | 1.83ms | 29.7ms | Moo::BEGIN@6 |
| 17 | 1 | 1 | 1.50ms | 1.65ms | Moo::make_class |
| 45 | 6 | 6 | 849µs | 66.4ms | Moo::has |
| 17 | 17 | 17 | 355µs | 4.86ms | Moo::import |
| 17 | 1 | 1 | 354µs | 2.31ms | Moo::_install_subs |
| 17 | 1 | 1 | 240µs | 240µs | Moo::_gen_subs |
| 9 | 9 | 9 | 110µs | 7.06ms | Moo::with |
| 60 | 3 | 1 | 101µs | 101µs | Moo::_maybe_reset_handlemoose |
| 2 | 1 | 1 | 100µs | 2.45ms | Moo::_set_superclasses |
| 17 | 1 | 1 | 49µs | 49µs | Moo::CORE:sort (opcode) |
| 292 | 1 | 1 | 43µs | 43µs | Moo::CORE:match (opcode) |
| 6 | 6 | 4 | 21µs | 1.11ms | Moo::around |
| 7 | 1 | 1 | 21µs | 21µs | Moo::is_class |
| 1 | 1 | 1 | 20µs | 22µs | Moo::BEGIN@2 |
| 2 | 2 | 2 | 19µs | 2.47ms | Moo::extends |
| 1 | 1 | 1 | 10µs | 14µs | Moo::BEGIN@230 |
| 1 | 1 | 1 | 6µs | 10µs | Moo::BEGIN@70 |
| 2 | 2 | 1 | 6µs | 266µs | Moo::before |
| 1 | 1 | 1 | 5µs | 8µs | Moo::BEGIN@180 |
| 1 | 1 | 1 | 5µs | 8µs | Moo::BEGIN@275 |
| 1 | 1 | 1 | 5µs | 24µs | Moo::BEGIN@3 |
| 1 | 1 | 1 | 5µs | 8µs | Moo::__ANON__[:256] |
| 1 | 1 | 1 | 4µs | 18µs | Moo::BEGIN@18 |
| 1 | 1 | 1 | 4µs | 19µs | Moo::BEGIN@4 |
| 1 | 1 | 1 | 3µs | 3µs | Moo::BEGIN@19 |
| 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 | 22µs | 2 | 24µs | # spent 22µs (20+2) within Moo::BEGIN@2 which was called:
# once (20µs+2µs) by OpenAPI::Modern::BEGIN@11 at line 2 # spent 22µs making 1 call to Moo::BEGIN@2
# spent 2µs making 1 call to strict::import |
| 3 | 2 | 15µs | 2 | 43µs | # spent 24µs (5+19) within Moo::BEGIN@3 which was called:
# once (5µs+19µs) by OpenAPI::Modern::BEGIN@11 at line 3 # spent 24µs making 1 call to Moo::BEGIN@3
# spent 19µs making 1 call to warnings::import |
| 4 | 2 | 25µs | 2 | 34µs | # spent 19µs (4+15) within Moo::BEGIN@4 which was called:
# once (4µs+15µs) by OpenAPI::Modern::BEGIN@11 at line 4 # spent 19µs making 1 call to Moo::BEGIN@4
# spent 15µs making 1 call to warnings::unimport |
| 5 | |||||
| 6 | 1 | 468µs | # spent 29.7ms (1.83+27.9) within Moo::BEGIN@6 which was called:
# once (1.83ms+27.9ms) 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 | 23µs | 2 | 29.8ms | ); # spent 29.7ms making 1 call to Moo::BEGIN@6
# spent 69µs making 1 call to Exporter::import |
| 18 | 2 | 26µs | 2 | 32µs | # spent 18µs (4+14) within Moo::BEGIN@18 which was called:
# once (4µs+14µs) by OpenAPI::Modern::BEGIN@11 at line 18 # spent 18µs making 1 call to Moo::BEGIN@18
# spent 14µs making 1 call to Exporter::import |
| 19 | # spent 3µs within Moo::BEGIN@19 which was called:
# once (3µs+0s) by OpenAPI::Modern::BEGIN@11 at line 27 | ||||
| 20 | 1 | 2µ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 | 170µs | 1 | 3µs | } # spent 3µ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 | 535µs | require Moo::sification; | ||
| 33 | 1 | 2µs | 1 | 4µs | Moo::sification->import; # spent 4µs making 1 call to Moo::sification::import |
| 34 | |||||
| 35 | our %MAKERS; | ||||
| 36 | |||||
| 37 | # spent 4.86ms (355µs+4.51) within Moo::import which was called 17 times, avg 286µs/call:
# once (19µs+1.04ms) by OpenAPI::Modern::BEGIN@11 at line 11 of OpenAPI/Modern.pm
# once (33µs+372µs) by Method::Generate::Constructor::BEGIN@12 at line 15 of Method/Generate/Constructor.pm
# once (25µs+358µs) by JSON::Schema::Modern::Vocabulary::Validation::BEGIN@10 at line 10 of /Users/ether/git/JSON-Schema-Modern/lib/JSON/Schema/Modern/Vocabulary/Validation.pm
# once (23µs+312µs) by JSON::Schema::Modern::Vocabulary::Unevaluated::BEGIN@10 at line 10 of /Users/ether/git/JSON-Schema-Modern/lib/JSON/Schema/Modern/Vocabulary/Unevaluated.pm
# once (51µs+247µs) by JSON::Schema::Modern::Document::OpenAPI::BEGIN@11 at line 11 of JSON/Schema/Modern/Document/OpenAPI.pm
# once (20µs+237µs) by JSON::Schema::Modern::Vocabulary::MetaData::BEGIN@10 at line 10 of /Users/ether/git/JSON-Schema-Modern/lib/JSON/Schema/Modern/Vocabulary/MetaData.pm
# once (20µs+220µs) by JSON::Schema::Modern::Vocabulary::FormatAnnotation::BEGIN@10 at line 10 of /Users/ether/git/JSON-Schema-Modern/lib/JSON/Schema/Modern/Vocabulary/FormatAnnotation.pm
# once (19µs+198µs) by JSON::Schema::Modern::Vocabulary::Core::BEGIN@10 at line 10 of /Users/ether/git/JSON-Schema-Modern/lib/JSON/Schema/Modern/Vocabulary/Core.pm
# once (23µs+180µs) by JSON::Schema::Modern::Document::BEGIN@10 at line 10 of /Users/ether/git/JSON-Schema-Modern/lib/JSON/Schema/Modern/Document.pm
# once (15µs+182µs) by JSON::Schema::Modern::Vocabulary::FormatAssertion::BEGIN@10 at line 10 of /Users/ether/git/JSON-Schema-Modern/lib/JSON/Schema/Modern/Vocabulary/FormatAssertion.pm
# once (14µs+183µs) by JSON::Schema::Modern::Vocabulary::Content::BEGIN@10 at line 10 of /Users/ether/git/JSON-Schema-Modern/lib/JSON/Schema/Modern/Vocabulary/Content.pm
# once (19µs+177µs) by JSON::Schema::Modern::Error::BEGIN@10 at line 10 of /Users/ether/git/JSON-Schema-Modern/lib/JSON/Schema/Modern/Error.pm
# once (18µs+177µs) by JSON::Schema::Modern::Result::BEGIN@10 at line 10 of /Users/ether/git/JSON-Schema-Modern/lib/JSON/Schema/Modern/Result.pm
# once (15µs+167µs) by JSON::Schema::Modern::Vocabulary::OpenAPI::BEGIN@10 at line 10 of JSON/Schema/Modern/Vocabulary/OpenAPI.pm
# once (14µs+156µs) by JSON::Schema::Modern::BEGIN@11 at line 11 of /Users/ether/git/JSON-Schema-Modern/lib/JSON/Schema/Modern.pm
# once (16µs+153µs) by JSON::Schema::Modern::Vocabulary::Applicator::BEGIN@10 at line 10 of /Users/ether/git/JSON-Schema-Modern/lib/JSON/Schema/Modern/Vocabulary/Applicator.pm
# once (11µs+153µs) by JSON::Schema::Modern::Annotation::BEGIN@10 at line 10 of /Users/ether/git/JSON-Schema-Modern/lib/JSON/Schema/Modern/Annotation.pm | ||||
| 38 | 17 | 13µs | my $target = caller; | ||
| 39 | 17 | 9µs | my $class = shift; | ||
| 40 | 17 | 46µs | 15 | 39µs | if ($INC{'Role/Tiny.pm'} and Role::Tiny->is_role($target)) { # spent 39µ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 | 83µs | 17 | 143µs | _set_loaded(caller); # spent 143µs making 17 calls to Moo::_Utils::_set_loaded, avg 8µs/call |
| 45 | |||||
| 46 | 17 | 59µs | 17 | 28µs | strict->import; # spent 28µs making 17 calls to strict::import, avg 2µs/call |
| 47 | 17 | 17µs | 17 | 338µs | warnings->import; # spent 338µs making 17 calls to warnings::import, avg 20µs/call |
| 48 | |||||
| 49 | 17 | 37µs | 17 | 2.31ms | $class->_install_subs($target, @_); # spent 2.31ms making 17 calls to Moo::_install_subs, avg 136µs/call |
| 50 | 17 | 29µs | 17 | 1.65ms | $class->make_class($target); # spent 1.65ms making 17 calls to Moo::make_class, avg 97µs/call |
| 51 | 17 | 50µs | return; | ||
| 52 | } | ||||
| 53 | |||||
| 54 | # spent 1.65ms (1.50+153µs) within Moo::make_class which was called 17 times, avg 97µs/call:
# 17 times (1.50ms+153µs) by Moo::import at line 50, avg 97µs/call | ||||
| 55 | 17 | 6µs | my ($me, $target) = @_; | ||
| 56 | |||||
| 57 | 17 | 22µs | my $makers = $MAKERS{$target} ||= {}; | ||
| 58 | 17 | 4µs | return $target if $makers->{is_class}; | ||
| 59 | |||||
| 60 | 17 | 52µs | 17 | 61µs | my $stash = _getstash($target); # spent 61µs making 17 calls to Moo::_Utils::_getstash, avg 4µs/call |
| 61 | $makers->{non_methods} = { | ||||
| 62 | map +($_ => \&{"${target}::${_}"}), | ||||
| 63 | 17 | 498µs | 292 | 43µs | grep exists &{"${target}::${_}"}, # spent 43µs making 292 calls to Moo::CORE:match, avg 147ns/call |
| 64 | grep !/::\z/ && !/\A\(/, | ||||
| 65 | keys %$stash | ||||
| 66 | }; | ||||
| 67 | |||||
| 68 | 17 | 4µs | $makers->{is_class} = 1; | ||
| 69 | { | ||||
| 70 | 19 | 444µs | 2 | 14µs | # spent 10µs (6+4) within Moo::BEGIN@70 which was called:
# once (6µs+4µs) by OpenAPI::Modern::BEGIN@11 at line 70 # spent 10µs making 1 call to Moo::BEGIN@70
# spent 4µs making 1 call to strict::unimport |
| 71 | @{"${target}::ISA"} = do { | ||||
| 72 | 34 | 430µs | require Moo::Object; ('Moo::Object'); | ||
| 73 | 17 | 186µs | } unless @{"${target}::ISA"}; | ||
| 74 | } | ||||
| 75 | 17 | 6µs | if ($INC{'Moo/HandleMoose.pm'} && !$Moo::sification::disabled) { | ||
| 76 | Moo::HandleMoose::inject_fake_metaclass_for($target); | ||||
| 77 | } | ||||
| 78 | 17 | 36µs | return $target; | ||
| 79 | } | ||||
| 80 | |||||
| 81 | # spent 21µs within Moo::is_class which was called 7 times, avg 3µs/call:
# 7 times (21µs+0s) by MooX::TypeTiny::import at line 14 of MooX/TypeTiny.pm, avg 3µs/call | ||||
| 82 | 7 | 6µs | my ($me, $class) = @_; | ||
| 83 | 7 | 26µs | return $MAKERS{$class} && $MAKERS{$class}{is_class}; | ||
| 84 | } | ||||
| 85 | |||||
| 86 | # spent 2.31ms (354µs+1.95) within Moo::_install_subs which was called 17 times, avg 136µs/call:
# 17 times (354µs+1.95ms) by Moo::import at line 49, avg 136µs/call | ||||
| 87 | 17 | 9µs | my ($me, $target) = @_; | ||
| 88 | 17 | 79µs | 17 | 240µs | my %install = $me->_gen_subs($target); # spent 240µs making 17 calls to Moo::_gen_subs, avg 14µs/call |
| 89 | _install_tracked $target => $_ => $install{$_} | ||||
| 90 | 17 | 249µs | 119 | 1.71ms | for sort keys %install; # spent 1.67ms making 102 calls to Moo::_Utils::_install_tracked, avg 16µs/call
# spent 49µs making 17 calls to Moo::CORE:sort, avg 3µs/call |
| 91 | 17 | 42µs | return; | ||
| 92 | } | ||||
| 93 | |||||
| 94 | # spent 240µs within Moo::_gen_subs which was called 17 times, avg 14µs/call:
# 17 times (240µs+0s) by Moo::_install_subs at line 88, avg 14µs/call | ||||
| 95 | 17 | 9µs | my ($me, $target) = @_; | ||
| 96 | return ( | ||||
| 97 | # spent 2.47ms (19µs+2.45) within Moo::extends which was called 2 times, avg 1.23ms/call:
# once (13µs+2.05ms) by JSON::Schema::Modern::Document::extends at line 6 of (eval 262)[Class/Method/Modifiers.pm:148]
# once (6µs+396µs) by JSON::Schema::Modern::Document::OpenAPI::extends at line 6 of (eval 386)[Class/Method/Modifiers.pm:148] | ||||
| 98 | 2 | 2µs | 2 | 2.45ms | $me->_set_superclasses($target, @_); # spent 2.45ms making 2 calls to Moo::_set_superclasses, avg 1.22ms/call |
| 99 | 2 | 2µs | 2 | 2µs | $me->_maybe_reset_handlemoose($target); # spent 2µs making 2 calls to Moo::_maybe_reset_handlemoose, avg 1µs/call |
| 100 | 2 | 12µs | return; | ||
| 101 | }, | ||||
| 102 | # spent 7.06ms (110µs+6.95) within Moo::with which was called 9 times, avg 785µs/call:
# once (12µs+3.66ms) by Module::Runtime::require_module at line 20 of /Users/ether/git/JSON-Schema-Modern/lib/JSON/Schema/Modern/Vocabulary/Core.pm
# once (14µs+572µs) by Module::Runtime::require_module at line 23 of /Users/ether/git/JSON-Schema-Modern/lib/JSON/Schema/Modern/Vocabulary/Validation.pm
# once (19µs+566µs) by Module::Runtime::require_module at line 24 of /Users/ether/git/JSON-Schema-Modern/lib/JSON/Schema/Modern/Vocabulary/Applicator.pm
# once (15µs+457µs) by Module::Runtime::require_module at line 20 of JSON/Schema/Modern/Vocabulary/OpenAPI.pm
# once (13µs+424µs) by Module::Runtime::require_module at line 21 of /Users/ether/git/JSON-Schema-Modern/lib/JSON/Schema/Modern/Vocabulary/FormatAssertion.pm
# once (10µs+340µs) by JSON::Schema::Modern::Vocabulary::Applicator::BEGIN@21 at line 21 of /Users/ether/git/JSON-Schema-Modern/lib/JSON/Schema/Modern/Vocabulary/Unevaluated.pm
# once (10µs+319µs) by Module::Runtime::require_module at line 20 of /Users/ether/git/JSON-Schema-Modern/lib/JSON/Schema/Modern/Vocabulary/MetaData.pm
# once (7µs+314µs) by Module::Runtime::require_module at line 22 of /Users/ether/git/JSON-Schema-Modern/lib/JSON/Schema/Modern/Vocabulary/Content.pm
# once (10µs+297µs) by Module::Runtime::require_module at line 21 of /Users/ether/git/JSON-Schema-Modern/lib/JSON/Schema/Modern/Vocabulary/FormatAnnotation.pm | ||||
| 103 | 9 | 13µs | require Moo::Role; | ||
| 104 | 9 | 39µs | 9 | 6.93ms | Moo::Role->apply_roles_to_package($target, @_); # spent 6.93ms making 9 calls to Role::Tiny::apply_roles_to_package, avg 770µs/call |
| 105 | 9 | 47µs | 9 | 21µs | $me->_maybe_reset_handlemoose($target); # spent 21µs making 9 calls to Moo::_maybe_reset_handlemoose, avg 2µs/call |
| 106 | }, | ||||
| 107 | # spent 66.4ms (849µs+65.5) within Moo::has which was called 45 times, avg 1.47ms/call:
# 16 times (273µs+30.7ms) by JSON::Schema::Modern::has at line 6 of (eval 33)[Class/Method/Modifiers.pm:148], avg 1.93ms/call
# 8 times (121µs+15.7ms) by JSON::Schema::Modern::Document::has at line 6 of (eval 260)[Class/Method/Modifiers.pm:148], avg 1.97ms/call
# 6 times (96µs+8.07ms) by MooX::HandlesVia::has at line 31 of MooX/HandlesVia.pm, avg 1.36ms/call
# 6 times (139µs+5.20ms) by JSON::Schema::Modern::Result::has at line 6 of (eval 219)[Class/Method/Modifiers.pm:148], avg 889µs/call
# 5 times (131µs+3.75ms) by JSON::Schema::Modern::Error::has at line 6 of (eval 192)[Class/Method/Modifiers.pm:148], avg 777µs/call
# 4 times (89µs+2.17ms) by JSON::Schema::Modern::Annotation::has at line 6 of (eval 225)[Class/Method/Modifiers.pm:148], avg 564µs/call | ||||
| 108 | 45 | 17µs | my $name_proto = shift; | ||
| 109 | 45 | 38µs | my @name_proto = ref $name_proto eq 'ARRAY' ? @$name_proto : $name_proto; | ||
| 110 | 45 | 32µ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 | 70µs | my %spec = @_; | ||
| 115 | 45 | 17µs | foreach my $name (@name_proto) { | ||
| 116 | # Note that when multiple attributes specified, each attribute | ||||
| 117 | # needs a separate \%specs hashref | ||||
| 118 | 49 | 31µs | my $spec_ref = @name_proto > 1 ? +{%spec} : \%spec; | ||
| 119 | 49 | 94µs | 98 | 1.24ms | $me->_constructor_maker_for($target) # spent 1.20ms making 49 calls to Method::Generate::Constructor::register_attribute_specs, avg 24µs/call
# spent 43µs making 49 calls to Moo::_constructor_maker_for, avg 878ns/call |
| 120 | ->register_attribute_specs($name, $spec_ref); | ||||
| 121 | 49 | 143µs | 98 | 64.2ms | $me->_accessor_maker_for($target) # spent 64.2ms making 49 calls to Method::Generate::Accessor::generate_method, avg 1.31ms/call
# spent 45µs making 49 calls to Moo::_accessor_maker_for, avg 918ns/call |
| 122 | ->generate_method($target, $name, $spec_ref); | ||||
| 123 | 49 | 111µs | 49 | 78µs | $me->_maybe_reset_handlemoose($target); # spent 78µs making 49 calls to Moo::_maybe_reset_handlemoose, avg 2µs/call |
| 124 | } | ||||
| 125 | 45 | 103µs | return; | ||
| 126 | }, | ||||
| 127 | (map { | ||||
| 128 | 68 | 186µs | my $type = $_; | ||
| 129 | ( | ||||
| 130 | # spent 1.11ms (21µs+1.09) within Moo::around which was called 6 times, avg 186µs/call:
# once (6µs+231µs) by OpenAPI::Modern::BEGIN@26 at line 685 of /Users/ether/git/JSON-Schema-Modern/lib/JSON/Schema/Modern.pm
# once (4µs+188µs) by OpenAPI::Modern::BEGIN@26 at line 133 of /Users/ether/git/JSON-Schema-Modern/lib/JSON/Schema/Modern.pm
# once (3µs+178µs) by JSON::Schema::Modern::BEGIN@35 at line 135 of /Users/ether/git/JSON-Schema-Modern/lib/JSON/Schema/Modern/Document.pm
# once (3µs+177µs) by JSON::Schema::Modern::Result::BEGIN@20 at line 62 of /Users/ether/git/JSON-Schema-Modern/lib/JSON/Schema/Modern/Annotation.pm
# once (2µs+170µs) by OpenAPI::Modern::BEGIN@26 at line 945 of /Users/ether/git/JSON-Schema-Modern/lib/JSON/Schema/Modern.pm
# once (3µs+149µs) by main::BEGIN@2 at line 79 of OpenAPI/Modern.pm
# spent 266µs (6+260) within Moo::before which was called 2 times, avg 133µs/call:
# once (4µs+171µs) by OpenAPI::Modern::BEGIN@26 at line 124 of /Users/ether/git/JSON-Schema-Modern/lib/JSON/Schema/Modern.pm
# once (2µs+89µs) by OpenAPI::Modern::BEGIN@26 at line 947 of /Users/ether/git/JSON-Schema-Modern/lib/JSON/Schema/Modern.pm | ||||
| 131 | 8 | 17µs | 8 | 1.35ms | _install_modifier($target, $type, @_); # spent 1.35ms making 8 calls to Moo::_Utils::_install_modifier, avg 169µs/call |
| 132 | 8 | 20µs | return; | ||
| 133 | }, | ||||
| 134 | ) | ||||
| 135 | 51 | 56µs | } qw(before after around)), | ||
| 136 | ); | ||||
| 137 | } | ||||
| 138 | |||||
| 139 | sub unimport { | ||||
| 140 | my $target = caller; | ||||
| 141 | _unimport_coderefs($target); | ||||
| 142 | } | ||||
| 143 | |||||
| 144 | # spent 2.45ms (100µs+2.35) within Moo::_set_superclasses which was called 2 times, avg 1.22ms/call:
# 2 times (100µs+2.35ms) by Moo::extends at line 98, avg 1.22ms/call | ||||
| 145 | 2 | 1µs | my $class = shift; | ||
| 146 | 2 | 0s | my $target = shift; | ||
| 147 | 2 | 2µs | foreach my $superclass (@_) { | ||
| 148 | 2 | 2µs | 2 | 1.75ms | _load_module($superclass); # spent 1.75ms making 2 calls to Moo::_Utils::_load_module, avg 874µs/call |
| 149 | 2 | 6µs | 2 | 2µs | if ($INC{'Role/Tiny.pm'} && Role::Tiny->is_role($superclass)) { # spent 2µs making 2 calls to Role::Tiny::is_role, avg 1µs/call |
| 150 | croak "Can't extend role '$superclass'"; | ||||
| 151 | } | ||||
| 152 | } | ||||
| 153 | 2 | 20µs | 2 | 3µs | @{*{_getglob("${target}::ISA")}} = @_; # spent 3µs making 2 calls to Moo::_Utils::_getglob, avg 2µs/call |
| 154 | 2 | 3µs | if (my $old = delete $Moo::MAKERS{$target}{constructor}) { | ||
| 155 | 2 | 1µs | 2 | 10µs | $old->assert_constructor; # spent 10µs making 2 calls to Method::Generate::Constructor::assert_constructor, avg 5µs/call |
| 156 | 2 | 24µs | 2 | 2µs | delete _getstash($target)->{new}; # spent 2µs making 2 calls to Moo::_Utils::_getstash, avg 1µs/call |
| 157 | Moo->_constructor_maker_for($target) | ||||
| 158 | 2 | 7µs | 6 | 582µs | ->register_attribute_specs(%{$old->all_attribute_specs}); # spent 566µs making 2 calls to Moo::_constructor_maker_for, avg 283µs/call
# spent 14µs making 2 calls to Method::Generate::Constructor::register_attribute_specs, avg 7µs/call
# spent 2µs making 2 calls to Method::Generate::Constructor::all_attribute_specs, avg 1µs/call |
| 159 | } | ||||
| 160 | elsif (!$target->isa('Moo::Object')) { | ||||
| 161 | Moo->_constructor_maker_for($target); | ||||
| 162 | } | ||||
| 163 | 2 | 18µs | 2 | 2µs | $Moo::HandleMoose::MOUSE{$target} = [ # spent 2µs making 2 calls to UNIVERSAL::can, avg 1µ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 | 130µs | if ($INC{'Moo/HandleMoose.pm'} && !$Moo::sification::disabled) { | ||
| 171 | Moo::HandleMoose::maybe_reinject_fake_metaclass_for($target); | ||||
| 172 | } | ||||
| 173 | } | ||||
| 174 | |||||
| 175 | # spent 9.83ms (3.79+6.04) within Moo::_accessor_maker_for which was called 116 times, avg 85µs/call:
# 49 times (45µs+0s) by Moo::has at line 121, avg 918ns/call
# 47 times (3.53ms+5.89ms) 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 200µs/call
# 10 times (156µs+125µs) by Moo::Role::_maybe_make_accessors at line 254 of Moo/Role.pm, avg 28µs/call
# 10 times (57µs+27µs) by Moo::_constructor_maker_for at line 207, avg 8µs/call | ||||
| 176 | 116 | 47µs | my ($class, $target) = @_; | ||
| 177 | 116 | 47µs | return unless $MAKERS{$target}; | ||
| 178 | 116 | 230µs | $MAKERS{$target}{accessor} ||= do { | ||
| 179 | 18 | 6µs | my $maker_class = do { | ||
| 180 | 2 | 175µs | 2 | 11µs | # spent 8µs (5+3) within Moo::BEGIN@180 which was called:
# once (5µs+3µs) by OpenAPI::Modern::BEGIN@11 at line 180 # spent 8µs making 1 call to Moo::BEGIN@180
# spent 3µs making 1 call to strict::unimport |
| 181 | 18 | 15µs | if (my $m = do { | ||
| 182 | 18 | 106µs | 18 | 44µs | my @isa = @{_linear_isa($target)}; # spent 44µs making 18 calls to mro::get_linear_isa, avg 2µs/call |
| 183 | 18 | 8µs | shift @isa; | ||
| 184 | 18 | 60µ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 | 330µs | require Method::Generate::Accessor; | ||
| 194 | 18 | 3µs | 'Method::Generate::Accessor' | ||
| 195 | } | ||||
| 196 | }; | ||||
| 197 | 18 | 44µs | 18 | 205µs | $maker_class->new; # spent 205µs making 18 calls to Moo::Object::new, avg 11µs/call |
| 198 | } | ||||
| 199 | } | ||||
| 200 | |||||
| 201 | # spent 8.42ms (2.99+5.43) within Moo::_constructor_maker_for which was called 99 times, avg 85µs/call:
# 49 times (43µs+0s) by Moo::has at line 119, avg 878ns/call
# 47 times (2.84ms+4.97ms) 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 166µs/call
# 2 times (56µs+510µs) by Moo::_set_superclasses at line 158, avg 283µs/call
# once (49µs+-49µs) by Moo::_constructor_maker_for at line 250 of Method/Generate/Constructor.pm | ||||
| 202 | 99 | 26µs | my ($class, $target) = @_; | ||
| 203 | 99 | 31µs | return unless $MAKERS{$target}; | ||
| 204 | 99 | 172µs | $MAKERS{$target}{constructor} ||= do { | ||
| 205 | 10 | 735µs | require Method::Generate::Constructor; | ||
| 206 | |||||
| 207 | 10 | 55µs | 10 | 84µs | my %construct_opts = ( # spent 84µs making 10 calls to Moo::_accessor_maker_for, avg 8µ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 | 31µs | 10 | 11µs | my @isa = @{_linear_isa($target)}; # spent 11µs making 10 calls to mro::get_linear_isa, avg 1µs/call |
| 229 | 10 | 4µs | shift @isa; | ||
| 230 | 2 | 249µs | 2 | 18µs | # spent 14µs (10+4) within Moo::BEGIN@230 which was called:
# once (10µs+4µs) by OpenAPI::Modern::BEGIN@11 at line 230 # spent 14µs making 1 call to Moo::BEGIN@230
# spent 4µs making 1 call to strict::unimport |
| 231 | 10 | 55µs | if (my ($parent_new) = grep +(defined &{$_.'::new'}), @isa) { | ||
| 232 | 10 | 13µs | 1 | 2µs | if ($parent_new eq 'Moo::Object') { # spent 2µ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 | 1µs | 1 | 16µs | $construct_opts{construction_string} = $con->construction_string # spent 16µ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 8µs (5+3) within Moo::__ANON__[/Users/ether/.perlbrew/libs/36.0@std/lib/perl5/Moo.pm:256] which was called:
# once (5µs+3µs) by Method::Generate::Constructor::_build_construction_string at line 68 of Method/Generate/Constructor.pm | ||||
| 252 | 1 | 9µs | 1 | 3µs | '$invoker->'.$target.'::SUPER::new(' # spent 3µs making 1 call to UNIVERSAL::can |
| 253 | .($target->can('FOREIGNBUILDARGS') ? | ||||
| 254 | '$class->FOREIGNBUILDARGS(@_)' : '@_') | ||||
| 255 | .')' | ||||
| 256 | 1 | 2µs | }; | ||
| 257 | } | ||||
| 258 | } | ||||
| 259 | ($con ? ref($con) : 'Method::Generate::Constructor') | ||||
| 260 | ->new(%construct_opts) | ||||
| 261 | ->install_delayed | ||||
| 262 | 10 | 78µs | 31 | 4.02ms | ->register_attribute_specs(%{$con?$con->all_attribute_specs:{}}) # spent 2.16ms making 10 calls to Method::Generate::Constructor::install_delayed, avg 216µs/call
# spent 1.66ms making 10 calls to Method::Generate::Constructor::new, avg 166µs/call
# spent 200µs making 10 calls to Method::Generate::Constructor::register_attribute_specs, avg 20µs/call
# spent 2µ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 | 144µs | 2 | 11µs | # spent 8µs (5+3) within Moo::BEGIN@275 which was called:
# once (5µs+3µs) by OpenAPI::Modern::BEGIN@11 at line 275 # spent 8µs making 1 call to Moo::BEGIN@275
# spent 3µ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 | 3µs | 1; | ||
| 295 | __END__ | ||||
# spent 43µs within Moo::CORE:match which was called 292 times, avg 147ns/call:
# 292 times (43µs+0s) by Moo::make_class at line 63, avg 147ns/call | |||||
# spent 49µs within Moo::CORE:sort which was called 17 times, avg 3µs/call:
# 17 times (49µs+0s) by Moo::_install_subs at line 90, avg 3µs/call |