Filename | /Users/ether/.perlbrew/libs/36.0@std/lib/perl5/Moo/Object.pm |
Statements | Executed 153 statements in 1.01ms |
Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
---|---|---|---|---|---|
21 | 2 | 2 | 211µs | 305µs | new | Moo::Object::
24 | 4 | 4 | 91µs | 91µs | BUILDARGS | Moo::Object::
1 | 1 | 1 | 44µs | 48µs | BEGIN@2 | Moo::Object::
1 | 1 | 1 | 32µs | 34µs | does | Moo::Object::
1 | 1 | 1 | 9µs | 46µs | BEGIN@3 | Moo::Object::
1 | 1 | 1 | 7µs | 26µs | BEGIN@67 | Moo::Object::
1 | 1 | 1 | 5µs | 5µs | BEGIN@5 | Moo::Object::
0 | 0 | 0 | 0s | 0s | BUILDALL | Moo::Object::
0 | 0 | 0 | 0s | 0s | DEMOLISHALL | Moo::Object::
0 | 0 | 0 | 0s | 0s | meta | Moo::Object::
Line | State ments |
Time on line |
Calls | Time in subs |
Code |
---|---|---|---|---|---|
1 | package Moo::Object; | ||||
2 | 2 | 40µs | 2 | 52µs | # spent 48µs (44+4) within Moo::Object::BEGIN@2 which was called:
# once (44µs+4µs) by Moo::make_class at line 2 # spent 48µs making 1 call to Moo::Object::BEGIN@2
# spent 4µs making 1 call to strict::import |
3 | 2 | 38µs | 2 | 83µs | # spent 46µs (9+37) within Moo::Object::BEGIN@3 which was called:
# once (9µs+37µs) by Moo::make_class at line 3 # spent 46µs making 1 call to Moo::Object::BEGIN@3
# spent 37µs making 1 call to warnings::import |
4 | |||||
5 | 2 | 387µs | 1 | 5µs | # spent 5µs within Moo::Object::BEGIN@5 which was called:
# once (5µs+0s) by Moo::make_class at line 5 # spent 5µs making 1 call to Moo::Object::BEGIN@5 |
6 | |||||
7 | our %NO_BUILD; | ||||
8 | our %NO_DEMOLISH; | ||||
9 | our $BUILD_MAKER; | ||||
10 | our $DEMOLISH_MAKER; | ||||
11 | |||||
12 | # spent 305µs (211+94) within Moo::Object::new which was called 21 times, avg 15µs/call:
# 18 times (164µs+73µs) by Moo::_accessor_maker_for at line 197 of Moo.pm, avg 13µs/call
# 3 times (47µs+21µs) by Method::Generate::Constructor::buildall_generator at line 62 of Method/Generate/Constructor.pm, avg 23µs/call | ||||
13 | 21 | 9µs | my $class = shift; | ||
14 | 21 | 20µs | unless (exists $NO_DEMOLISH{$class}) { | ||
15 | 2 | 40µs | 2 | 8µs | unless ($NO_DEMOLISH{$class} = !$class->can('DEMOLISH')) { # spent 8µs making 2 calls to UNIVERSAL::can, avg 4µs/call |
16 | ($DEMOLISH_MAKER ||= do { | ||||
17 | require Method::Generate::DemolishAll; | ||||
18 | Method::Generate::DemolishAll->new | ||||
19 | })->generate_method($class); | ||||
20 | } | ||||
21 | } | ||||
22 | 21 | 57µs | 21 | 81µs | my $proto = $class->BUILDARGS(@_); # spent 81µs making 21 calls to Moo::Object::BUILDARGS, avg 4µs/call |
23 | 21 | 84µs | $NO_BUILD{$class} and | ||
24 | return bless({}, $class); | ||||
25 | 2 | 12µs | 2 | 5µs | $NO_BUILD{$class} = !$class->can('BUILD') unless exists $NO_BUILD{$class}; # spent 5µs making 2 calls to UNIVERSAL::can, avg 2µs/call |
26 | 2 | 10µs | $NO_BUILD{$class} | ||
27 | ? bless({}, $class) | ||||
28 | : bless({}, $class)->BUILDALL($proto); | ||||
29 | } | ||||
30 | |||||
31 | # Inlined into Method::Generate::Constructor::_generate_args() - keep in sync | ||||
32 | # spent 91µs within Moo::Object::BUILDARGS which was called 24 times, avg 4µs/call:
# 21 times (81µs+0s) by Moo::Object::new at line 22, avg 4µs/call
# once (5µs+0s) by OpenAPI::Modern::__ANON__[/Users/ether/.perlbrew/libs/36.0@std/lib/perl5/OpenAPI/Modern.pm:79] at line 55 of OpenAPI/Modern.pm
# once (4µs+0s) by JSON::Schema::Modern::__ANON__[/Users/ether/.perlbrew/libs/36.0@std/lib/perl5/JSON/Schema/Modern.pm:133] at line 127 of JSON/Schema/Modern.pm
# once (1µs+0s) by Method::Generate::Constructor::new at line 248 of Method/Generate/Constructor.pm | ||||
33 | 24 | 8µs | my $class = shift; | ||
34 | scalar @_ == 1 | ||||
35 | ? ref $_[0] eq 'HASH' | ||||
36 | 24 | 116µs | ? { %{ $_[0] } } | ||
37 | : Carp::croak("Single parameters to new() must be a HASH ref" | ||||
38 | . " data => ". $_[0]) | ||||
39 | : @_ % 2 | ||||
40 | ? Carp::croak("The new() method for $class expects a hash reference or a" | ||||
41 | . " key/value list. You passed an odd number of arguments") | ||||
42 | : {@_} | ||||
43 | ; | ||||
44 | } | ||||
45 | |||||
46 | sub BUILDALL { | ||||
47 | my $self = shift; | ||||
48 | $self->${\(($BUILD_MAKER ||= do { | ||||
49 | require Method::Generate::BuildAll; | ||||
50 | Method::Generate::BuildAll->new | ||||
51 | })->generate_method(ref($self)))}(@_); | ||||
52 | } | ||||
53 | |||||
54 | sub DEMOLISHALL { | ||||
55 | my $self = shift; | ||||
56 | $self->${\(($DEMOLISH_MAKER ||= do { | ||||
57 | require Method::Generate::DemolishAll; | ||||
58 | Method::Generate::DemolishAll->new | ||||
59 | })->generate_method(ref($self)))}(@_); | ||||
60 | } | ||||
61 | |||||
62 | # spent 34µs (32+2) within Moo::Object::does which was called:
# once (32µs+2µs) by MooX::TypeTiny::__ANON__[/Users/ether/.perlbrew/libs/36.0@std/lib/perl5/MooX/TypeTiny.pm:25] at line 21 of MooX/TypeTiny.pm | ||||
63 | return !!0 | ||||
64 | 1 | 3µs | unless ($INC{'Moose/Role.pm'} || $INC{'Role/Tiny.pm'}); | ||
65 | 1 | 1µs | require Moo::Role; | ||
66 | 1 | 13µs | 1 | 2µs | my $does = Moo::Role->can("does_role"); # spent 2µs making 1 call to UNIVERSAL::can |
67 | 4 | 165µs | 2 | 45µs | # spent 26µs (7+19) within Moo::Object::BEGIN@67 which was called:
# once (7µs+19µs) by Moo::make_class at line 67 # spent 26µs making 1 call to Moo::Object::BEGIN@67
# spent 19µs making 1 call to warnings::unimport |
68 | 1 | 7µs | 1 | 23µs | goto &$does; # spent 23µs making 1 call to Moo::Role::does_role |
69 | } | ||||
70 | |||||
71 | # duplicated in Moo::Role | ||||
72 | sub meta { | ||||
73 | require Moo::HandleMoose::FakeMetaClass; | ||||
74 | my $class = ref($_[0])||$_[0]; | ||||
75 | bless({ name => $class }, 'Moo::HandleMoose::FakeMetaClass'); | ||||
76 | } | ||||
77 | |||||
78 | 1 | 5µs | 1; |