| Filename | /home/doy/coding/src/Moose/blib/lib//Moose/Meta/Class.pm |
| Statements | Executed 18013 statements in 319ms |
| Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
|---|---|---|---|---|---|
| 789 | 8 | 3 | 55.1ms | 710ms | Moose::Meta::Class::superclasses (recurses: max depth 1, inclusive time 43.3ms) |
| 314 | 2 | 1 | 47.2ms | 70.5ms | Moose::Meta::Class::_base_metaclasses |
| 101 | 2 | 2 | 29.4ms | 396ms | Moose::Meta::Class::new_object |
| 73 | 1 | 1 | 18.7ms | 113ms | Moose::Meta::Class::excludes_role |
| 1884 | 1 | 1 | 17.4ms | 17.4ms | Moose::Meta::Class::CORE:subst (opcode) |
| 42 | 1 | 1 | 9.89ms | 569ms | Moose::Meta::Class::reinitialize |
| 132 | 1 | 1 | 8.83ms | 118ms | Moose::Meta::Class::_inline_slot_initializer |
| 1 | 1 | 1 | 8.71ms | 12.7ms | Moose::Meta::Class::BEGIN@26 |
| 114 | 1 | 1 | 8.03ms | 49.8ms | Moose::Meta::Class::_inline_init_attr_from_constructor |
| 132 | 1 | 1 | 7.55ms | 11.3ms | Moose::Meta::Class::_inline_check_required_attr |
| 72 | 3 | 3 | 7.43ms | 2.65s | Moose::Meta::Class::add_attribute (recurses: max depth 1, inclusive time 74.8ms) |
| 132 | 2 | 1 | 7.05ms | 36.5ms | Moose::Meta::Class::_inline_init_attr_from_default |
| 44 | 2 | 2 | 6.99ms | 38.7ms | Moose::Meta::Class::does_role |
| 158 | 2 | 1 | 6.86ms | 9.76ms | Moose::Meta::Class::CORE:sort (opcode) |
| 116 | 4 | 4 | 6.58ms | 1.01s | Moose::Meta::Class::create_anon_class |
| 111 | 4 | 4 | 6.19ms | 641ms | Moose::Meta::Class::initialize |
| 42 | 1 | 1 | 5.51ms | 31.1ms | Moose::Meta::Class::_inline_triggers |
| 73 | 1 | 1 | 3.71ms | 6.22ms | Moose::Meta::Class::add_role |
| 42 | 1 | 1 | 3.47ms | 36.5ms | Moose::Meta::Class::_inline_BUILDARGS |
| 73 | 1 | 1 | 3.45ms | 5.31ms | Moose::Meta::Class::add_role_application |
| 116 | 1 | 1 | 3.28ms | 3.75ms | Moose::Meta::Class::_anon_cache_key |
| 1 | 1 | 1 | 2.86ms | 4.01ms | Moose::Meta::Class::BEGIN@24 |
| 50 | 1 | 1 | 2.73ms | 618ms | Moose::Meta::Class::_process_new_attribute |
| 51 | 1 | 1 | 2.71ms | 624ms | Moose::Meta::Class::_process_attribute |
| 36 | 1 | 1 | 1.99ms | 46.0ms | Moose::Meta::Class::add_override_method_modifier |
| 1 | 1 | 1 | 1.89ms | 3.18ms | Moose::Meta::Class::BEGIN@23 |
| 43 | 1 | 1 | 1.88ms | 7.61ms | Moose::Meta::Class::_immutable_options |
| 23 | 2 | 1 | 1.76ms | 1.01s | Moose::Meta::Class::create |
| 1 | 1 | 1 | 1.61ms | 14.8ms | Moose::Meta::Class::BEGIN@21 |
| 1 | 1 | 1 | 1.59ms | 2.38ms | Moose::Meta::Class::BEGIN@22 |
| 42 | 1 | 1 | 1.55ms | 86.6ms | Moose::Meta::Class::_inline_extra_init |
| 42 | 2 | 2 | 1.42ms | 36.1ms | Moose::Meta::Class::_inline_BUILDALL |
| 1 | 1 | 1 | 1.40ms | 1.89ms | Moose::Meta::Class::BEGIN@20 |
| 1 | 1 | 1 | 1.35ms | 14.7ms | Moose::Meta::Class::BEGIN@19 |
| 42 | 1 | 1 | 1.33ms | 37.9ms | Moose::Meta::Class::_inline_params |
| 70 | 2 | 1 | 1.26ms | 1.26ms | Moose::Meta::Class::_inline_throw_error |
| 111 | 1 | 1 | 1.25ms | 1.25ms | Moose::Meta::Class::__ANON__[:40] |
| 111 | 1 | 1 | 1.25ms | 1.25ms | Moose::Meta::Class::__ANON__[:35] |
| 1 | 1 | 1 | 1.17ms | 1.85ms | Moose::Meta::Class::BEGIN@25 |
| 42 | 1 | 1 | 807µs | 807µs | Moose::Meta::Class::_generate_fallback_constructor |
| 69 | 1 | 1 | 677µs | 677µs | Moose::Meta::Class::_meta_method_class |
| 6 | 1 | 1 | 502µs | 1.62ms | Moose::Meta::Class::calculate_all_roles |
| 51 | 1 | 1 | 283µs | 283µs | Moose::Meta::Class::CORE:match (opcode) |
| 1 | 1 | 1 | 115µs | 2.43ms | Moose::Meta::Class::_process_inherited_attribute |
| 1 | 1 | 1 | 100µs | 119µs | Moose::Meta::Class::BEGIN@4 |
| 1 | 1 | 1 | 41µs | 63µs | Moose::Meta::Class::BEGIN@10 |
| 1 | 1 | 1 | 39µs | 105µs | Moose::Meta::Class::BEGIN@5 |
| 1 | 1 | 1 | 38µs | 310µs | Moose::Meta::Class::BEGIN@29 |
| 1 | 1 | 1 | 37µs | 190µs | Moose::Meta::Class::BEGIN@13 |
| 1 | 1 | 1 | 37µs | 242µs | Moose::Meta::Class::BEGIN@12 |
| 1 | 1 | 1 | 36µs | 167µs | Moose::Meta::Class::BEGIN@11 |
| 1 | 1 | 1 | 36µs | 217µs | Moose::Meta::Class::BEGIN@9 |
| 1 | 1 | 1 | 30µs | 30µs | Moose::Meta::Class::BEGIN@27 |
| 1 | 1 | 1 | 24µs | 24µs | Moose::Meta::Class::BEGIN@7 |
| 0 | 0 | 0 | 0s | 0s | Moose::Meta::Class::_find_next_method_by_name_which_is_not_overridden |
| 0 | 0 | 0 | 0s | 0s | Moose::Meta::Class::_fix_class_metaclass_incompatibility |
| 0 | 0 | 0 | 0s | 0s | Moose::Meta::Class::_fix_single_metaclass_incompatibility |
| 0 | 0 | 0 | 0s | 0s | Moose::Meta::Class::_replace_self |
| 0 | 0 | 0 | 0s | 0s | Moose::Meta::Class::add_augment_method_modifier |
| 0 | 0 | 0 | 0s | 0s | Moose::Meta::Class::calculate_all_roles_with_inheritance |
| 0 | 0 | 0 | 0s | 0s | Moose::Meta::Class::create_error |
| 0 | 0 | 0 | 0s | 0s | Moose::Meta::Class::raise_error |
| 0 | 0 | 0 | 0s | 0s | Moose::Meta::Class::role_applications |
| 0 | 0 | 0 | 0s | 0s | Moose::Meta::Class::throw_error |
| Line | State ments |
Time on line |
Calls | Time in subs |
Code |
|---|---|---|---|---|---|
| 1 | |||||
| 2 | package Moose::Meta::Class; | ||||
| 3 | |||||
| 4 | 3 | 137µs | 2 | 138µs | # spent 119µs (100+19) within Moose::Meta::Class::BEGIN@4 which was called:
# once (100µs+19µs) by Moose::BEGIN@19 at line 4 # spent 119µs making 1 call to Moose::Meta::Class::BEGIN@4
# spent 19µs making 1 call to strict::import |
| 5 | 3 | 94µs | 2 | 172µs | # spent 105µs (39+66) within Moose::Meta::Class::BEGIN@5 which was called:
# once (39µs+66µs) by Moose::BEGIN@19 at line 5 # spent 105µs making 1 call to Moose::Meta::Class::BEGIN@5
# spent 66µs making 1 call to warnings::import |
| 6 | |||||
| 7 | 3 | 95µs | 1 | 24µs | # spent 24µs within Moose::Meta::Class::BEGIN@7 which was called:
# once (24µs+0s) by Moose::BEGIN@19 at line 7 # spent 24µs making 1 call to Moose::Meta::Class::BEGIN@7 |
| 8 | |||||
| 9 | 3 | 102µs | 2 | 399µs | # spent 217µs (36+181) within Moose::Meta::Class::BEGIN@9 which was called:
# once (36µs+181µs) by Moose::BEGIN@19 at line 9 # spent 217µs making 1 call to Moose::Meta::Class::BEGIN@9
# spent 181µs making 1 call to Exporter::import |
| 10 | 3 | 111µs | 2 | 85µs | # spent 63µs (41+22) within Moose::Meta::Class::BEGIN@10 which was called:
# once (41µs+22µs) by Moose::BEGIN@19 at line 10 # spent 63µs making 1 call to Moose::Meta::Class::BEGIN@10
# spent 22µs making 1 call to Sub::Install::__ANON__[Sub/Install.pm:284] |
| 11 | 3 | 103µs | 2 | 297µs | # spent 167µs (36+130) within Moose::Meta::Class::BEGIN@11 which was called:
# once (36µs+130µs) by Moose::BEGIN@19 at line 11 # spent 167µs making 1 call to Moose::Meta::Class::BEGIN@11
# spent 130µs making 1 call to Exporter::import |
| 12 | 3 | 105µs | 2 | 448µs | # spent 242µs (37+206) within Moose::Meta::Class::BEGIN@12 which was called:
# once (37µs+206µs) by Moose::BEGIN@19 at line 12 # spent 242µs making 1 call to Moose::Meta::Class::BEGIN@12
# spent 206µs making 1 call to Exporter::import |
| 13 | 3 | 223µs | 2 | 343µs | # spent 190µs (37+153) within Moose::Meta::Class::BEGIN@13 which was called:
# once (37µs+153µs) by Moose::BEGIN@19 at line 13 # spent 190µs making 1 call to Moose::Meta::Class::BEGIN@13
# spent 153µs making 1 call to Exporter::import |
| 14 | |||||
| 15 | 1 | 4µs | our $VERSION = '1.19'; | ||
| 16 | 1 | 71µs | $VERSION = eval $VERSION; # spent 12µs executing statements in string eval | ||
| 17 | 1 | 4µs | our $AUTHORITY = 'cpan:STEVAN'; | ||
| 18 | |||||
| 19 | 3 | 480µs | 1 | 14.7ms | # spent 14.7ms (1.35+13.3) within Moose::Meta::Class::BEGIN@19 which was called:
# once (1.35ms+13.3ms) by Moose::BEGIN@19 at line 19 # spent 14.7ms making 1 call to Moose::Meta::Class::BEGIN@19 |
| 20 | 3 | 487µs | 1 | 1.89ms | # spent 1.89ms (1.40+490µs) within Moose::Meta::Class::BEGIN@20 which was called:
# once (1.40ms+490µs) by Moose::BEGIN@19 at line 20 # spent 1.89ms making 1 call to Moose::Meta::Class::BEGIN@20 |
| 21 | 3 | 457µs | 1 | 14.8ms | # spent 14.8ms (1.61+13.1) within Moose::Meta::Class::BEGIN@21 which was called:
# once (1.61ms+13.1ms) by Moose::BEGIN@19 at line 21 # spent 14.8ms making 1 call to Moose::Meta::Class::BEGIN@21 |
| 22 | 3 | 475µs | 1 | 2.38ms | # spent 2.38ms (1.59+789µs) within Moose::Meta::Class::BEGIN@22 which was called:
# once (1.59ms+789µs) by Moose::BEGIN@19 at line 22 # spent 2.38ms making 1 call to Moose::Meta::Class::BEGIN@22 |
| 23 | 3 | 485µs | 1 | 3.18ms | # spent 3.18ms (1.89+1.30) within Moose::Meta::Class::BEGIN@23 which was called:
# once (1.89ms+1.30ms) by Moose::BEGIN@19 at line 23 # spent 3.18ms making 1 call to Moose::Meta::Class::BEGIN@23 |
| 24 | 3 | 488µs | 1 | 4.01ms | # spent 4.01ms (2.86+1.15) within Moose::Meta::Class::BEGIN@24 which was called:
# once (2.86ms+1.15ms) by Moose::BEGIN@19 at line 24 # spent 4.01ms making 1 call to Moose::Meta::Class::BEGIN@24 |
| 25 | 3 | 459µs | 1 | 1.85ms | # spent 1.85ms (1.17+678µs) within Moose::Meta::Class::BEGIN@25 which was called:
# once (1.17ms+678µs) by Moose::BEGIN@19 at line 25 # spent 1.85ms making 1 call to Moose::Meta::Class::BEGIN@25 |
| 26 | 3 | 493µs | 2 | 13.2ms | # spent 12.7ms (8.71+3.94) within Moose::Meta::Class::BEGIN@26 which was called:
# once (8.71ms+3.94ms) by Moose::BEGIN@19 at line 26 # spent 12.7ms making 1 call to Moose::Meta::Class::BEGIN@26
# spent 586µs making 1 call to Sub::Exporter::__ANON__[Sub/Exporter.pm:756] |
| 27 | 3 | 107µs | 1 | 30µs | # spent 30µs within Moose::Meta::Class::BEGIN@27 which was called:
# once (30µs+0s) by Moose::BEGIN@19 at line 27 # spent 30µs making 1 call to Moose::Meta::Class::BEGIN@27 |
| 28 | |||||
| 29 | 3 | 10.6ms | 2 | 582µs | # spent 310µs (38+272) within Moose::Meta::Class::BEGIN@29 which was called:
# once (38µs+272µs) by Moose::BEGIN@19 at line 29 # spent 310µs making 1 call to Moose::Meta::Class::BEGIN@29
# spent 272µs making 1 call to base::import |
| 30 | |||||
| 31 | 1 | 15µs | 1 | 8.92ms | Class::MOP::MiniTrait::apply(__PACKAGE__, 'Moose::Meta::Object::Trait'); # spent 8.92ms making 1 call to Class::MOP::MiniTrait::apply |
| 32 | |||||
| 33 | __PACKAGE__->meta->add_attribute('roles' => ( | ||||
| 34 | reader => 'roles', | ||||
| 35 | 111 | 1.50ms | # spent 1.25ms within Moose::Meta::Class::__ANON__[/home/doy/coding/src/Moose/blib/lib//Moose/Meta/Class.pm:35] which was called 111 times, avg 11µs/call:
# 111 times (1.25ms+0s) by Class::MOP::Mixin::AttributeCore::default at line 43 of Class/MOP/Mixin/AttributeCore.pm, avg 11µs/call | ||
| 36 | 1 | 64µs | 2 | 2.71ms | )); # spent 2.63ms making 1 call to Class::MOP::Mixin::HasAttributes::add_attribute
# spent 81µs making 1 call to Class::MOP::Object::meta |
| 37 | |||||
| 38 | __PACKAGE__->meta->add_attribute('role_applications' => ( | ||||
| 39 | reader => '_get_role_applications', | ||||
| 40 | 111 | 1.44ms | # spent 1.25ms within Moose::Meta::Class::__ANON__[/home/doy/coding/src/Moose/blib/lib//Moose/Meta/Class.pm:40] which was called 111 times, avg 11µs/call:
# 111 times (1.25ms+0s) by Class::MOP::Mixin::AttributeCore::default at line 43 of Class/MOP/Mixin/AttributeCore.pm, avg 11µs/call | ||
| 41 | 1 | 32µs | 2 | 2.18ms | )); # spent 2.10ms making 1 call to Class::MOP::Mixin::HasAttributes::add_attribute
# spent 86µs making 1 call to Class::MOP::Object::meta |
| 42 | |||||
| 43 | 1 | 41µs | 3 | 2.07ms | __PACKAGE__->meta->add_attribute( # spent 1.86ms making 1 call to Class::MOP::Mixin::HasAttributes::add_attribute
# spent 124µs making 1 call to Class::MOP::Attribute::new
# spent 86µs making 1 call to Class::MOP::Object::meta |
| 44 | Class::MOP::Attribute->new('immutable_trait' => ( | ||||
| 45 | accessor => "immutable_trait", | ||||
| 46 | default => 'Moose::Meta::Class::Immutable::Trait', | ||||
| 47 | )) | ||||
| 48 | ); | ||||
| 49 | |||||
| 50 | 1 | 26µs | 2 | 1.95ms | __PACKAGE__->meta->add_attribute('constructor_class' => ( # spent 1.87ms making 1 call to Class::MOP::Mixin::HasAttributes::add_attribute
# spent 86µs making 1 call to Class::MOP::Object::meta |
| 51 | accessor => 'constructor_class', | ||||
| 52 | default => 'Moose::Meta::Method::Constructor', | ||||
| 53 | )); | ||||
| 54 | |||||
| 55 | 1 | 25µs | 2 | 1.99ms | __PACKAGE__->meta->add_attribute('destructor_class' => ( # spent 1.87ms making 1 call to Class::MOP::Mixin::HasAttributes::add_attribute
# spent 117µs making 1 call to Class::MOP::Object::meta |
| 56 | accessor => 'destructor_class', | ||||
| 57 | default => 'Moose::Meta::Method::Destructor', | ||||
| 58 | )); | ||||
| 59 | |||||
| 60 | 1 | 27µs | 2 | 2.06ms | __PACKAGE__->meta->add_attribute('error_class' => ( # spent 1.96ms making 1 call to Class::MOP::Mixin::HasAttributes::add_attribute
# spent 98µs making 1 call to Class::MOP::Object::meta |
| 61 | accessor => 'error_class', | ||||
| 62 | default => 'Moose::Error::Default', | ||||
| 63 | )); | ||||
| 64 | |||||
| 65 | # spent 641ms (6.19+635) within Moose::Meta::Class::initialize which was called 111 times, avg 5.78ms/call:
# 45 times (2.62ms+184ms) by Moose::init_meta at line 199 of Moose.pm, avg 4.14ms/call
# 42 times (2.23ms+354ms) by Class::MOP::Package::reinitialize at line 60 of Class/MOP/Package.pm, avg 8.48ms/call
# 23 times (1.23ms+91.5ms) by Class::MOP::Class::create at line 513 of Class/MOP/Class.pm, avg 4.03ms/call
# once (111µs+6.30ms) by metaclass::import at line 45 of metaclass.pm | ||||
| 66 | 333 | 7.47ms | my $class = shift; | ||
| 67 | my $pkg = shift; | ||||
| 68 | 222 | 635ms | return Class::MOP::get_metaclass_by_name($pkg) # spent 634ms making 111 calls to Class::MOP::Class::initialize, avg 5.71ms/call
# spent 1.00ms making 111 calls to Class::MOP::get_metaclass_by_name, avg 9µs/call | ||
| 69 | || $class->SUPER::initialize($pkg, | ||||
| 70 | 'attribute_metaclass' => 'Moose::Meta::Attribute', | ||||
| 71 | 'method_metaclass' => 'Moose::Meta::Method', | ||||
| 72 | 'instance_metaclass' => 'Moose::Meta::Instance', | ||||
| 73 | @_ | ||||
| 74 | ); | ||||
| 75 | } | ||||
| 76 | |||||
| 77 | # spent 1.01s (1.76ms+1.00) within Moose::Meta::Class::create which was called 23 times, avg 43.7ms/call:
# 22 times (1.70ms+992ms) by Class::MOP::Class::create_anon_class at line 441 of Class/MOP/Class.pm, avg 45.2ms/call
# once (62µs+12.0ms) by Class::MOP::Class::_immutable_metaclass at line 1387 of Class/MOP/Class.pm | ||||
| 78 | 138 | 1.75ms | my ($class, $package_name, %options) = @_; | ||
| 79 | |||||
| 80 | (ref $options{roles} eq 'ARRAY') | ||||
| 81 | || $class->throw_error("You must pass an ARRAY ref of roles", data => $options{roles}) | ||||
| 82 | if exists $options{roles}; | ||||
| 83 | my $roles = delete $options{roles}; | ||||
| 84 | |||||
| 85 | 23 | 318ms | my $new_meta = $class->SUPER::create($package_name, %options); # spent 318ms making 23 calls to Class::MOP::Class::create, avg 13.8ms/call | ||
| 86 | |||||
| 87 | 20 | 686ms | if ($roles) { # spent 686ms making 20 calls to Moose::Util::apply_all_roles, avg 34.3ms/call | ||
| 88 | Moose::Util::apply_all_roles( $new_meta, @$roles ); | ||||
| 89 | } | ||||
| 90 | |||||
| 91 | return $new_meta; | ||||
| 92 | } | ||||
| 93 | |||||
| 94 | 1 | 2µs | my %ANON_CLASSES; | ||
| 95 | |||||
| 96 | # spent 1.01s (6.58ms+999ms) within Moose::Meta::Class::create_anon_class which was called 116 times, avg 8.66ms/call:
# 80 times (3.76ms+60.1ms) by Moose::Util::MetaRole::_make_new_class at line 163 of Moose/Util/MetaRole.pm, avg 799µs/call
# 28 times (2.06ms+660ms) by Moose::Meta::Attribute::Native::Trait::_native_accessor_class_for at line 173 of Moose/Meta/Attribute/Native/Trait.pm, avg 23.7ms/call
# 6 times (570µs+253ms) by Moose::Meta::Attribute::interpolate_class at line 129 of Moose/Meta/Attribute.pm, avg 42.3ms/call
# 2 times (184µs+25.0ms) by MooseX::Role::Parameterized::Meta::Role::Parameterizable::__ANON__[/home/doy/perl5/perlbrew/perls/perl-5.10.1/lib/site_perl/5.10.1/MooseX/Role/Parameterized/Meta/Role/Parameterizable.pm:31] at line 27 of MooseX/Role/Parameterized/Meta/Role/Parameterizable.pm, avg 12.6ms/call | ||||
| 97 | 552 | 6.34ms | my ($self, %options) = @_; | ||
| 98 | |||||
| 99 | my $cache_ok = delete $options{cache}; | ||||
| 100 | |||||
| 101 | 116 | 3.75ms | my $cache_key # spent 3.75ms making 116 calls to Moose::Meta::Class::_anon_cache_key, avg 32µs/call | ||
| 102 | = _anon_cache_key( $options{superclasses}, $options{roles} ); | ||||
| 103 | |||||
| 104 | if ($cache_ok && defined $ANON_CLASSES{$cache_key}) { | ||||
| 105 | return $ANON_CLASSES{$cache_key}; | ||||
| 106 | } | ||||
| 107 | |||||
| 108 | $options{weaken} = !$cache_ok | ||||
| 109 | unless exists $options{weaken}; | ||||
| 110 | |||||
| 111 | 22 | 995ms | my $new_class = $self->SUPER::create_anon_class(%options); # spent 995ms making 22 calls to Class::MOP::Class::create_anon_class, avg 45.2ms/call | ||
| 112 | |||||
| 113 | 40 | 534µs | if ($cache_ok) { | ||
| 114 | $ANON_CLASSES{$cache_key} = $new_class; | ||||
| 115 | 20 | 127µs | weaken($ANON_CLASSES{$cache_key}); # spent 127µs making 20 calls to Scalar::Util::weaken, avg 6µs/call | ||
| 116 | } | ||||
| 117 | |||||
| 118 | return $new_class; | ||||
| 119 | } | ||||
| 120 | |||||
| 121 | 69 | 864µs | # spent 677µs within Moose::Meta::Class::_meta_method_class which was called 69 times, avg 10µs/call:
# 69 times (677µs+0s) by Class::MOP::Mixin::HasMethods::_add_meta_method at line 28 of Class/MOP/Mixin/HasMethods.pm, avg 10µs/call | ||
| 122 | |||||
| 123 | # spent 3.75ms (3.28+475µs) within Moose::Meta::Class::_anon_cache_key which was called 116 times, avg 32µs/call:
# 116 times (3.28ms+475µs) by Moose::Meta::Class::create_anon_class at line 101, avg 32µs/call | ||||
| 124 | # Makes something like Super::Class|Super::Class::2=Role|Role::1 | ||||
| 125 | return join '=' => ( | ||||
| 126 | join( '|', @{ $_[0] || [] } ), | ||||
| 127 | 116 | 3.86ms | 116 | 475µs | join( '|', sort @{ $_[1] || [] } ), # spent 475µs making 116 calls to Moose::Meta::Class::CORE:sort, avg 4µs/call |
| 128 | ); | ||||
| 129 | } | ||||
| 130 | |||||
| 131 | # spent 569ms (9.89+560) within Moose::Meta::Class::reinitialize which was called 42 times, avg 13.6ms/call:
# 42 times (9.89ms+560ms) by Moose::Util::MetaRole::_make_new_metaclass at line 128 of Moose/Util/MetaRole.pm, avg 13.6ms/call | ||||
| 132 | 336 | 3.71ms | my $self = shift; | ||
| 133 | my $pkg = shift; | ||||
| 134 | |||||
| 135 | 42 | 251µs | my $meta = blessed $pkg ? $pkg : Class::MOP::class_of($pkg); # spent 251µs making 42 calls to Scalar::Util::blessed, avg 6µs/call | ||
| 136 | |||||
| 137 | my $cache_key; | ||||
| 138 | |||||
| 139 | my %existing_classes; | ||||
| 140 | 84 | 6.95ms | if ($meta) { | ||
| 141 | 294 | 2.82ms | %existing_classes = map { $_ => $meta->$_() } qw( # spent 644µs making 42 calls to Moose::Meta::Class::destructor_class, avg 15µs/call
# spent 637µs making 42 calls to Moose::Meta::Class::constructor_class, avg 15µs/call
# spent 574µs making 42 calls to Moose::Meta::Class::error_class, avg 14µs/call
# spent 295µs making 42 calls to Class::MOP::Mixin::HasAttributes::attribute_metaclass, avg 7µs/call
# spent 239µs making 42 calls to Class::MOP::Mixin::HasMethods::method_metaclass, avg 6µs/call
# spent 229µs making 42 calls to Class::MOP::Class::instance_metaclass, avg 5µs/call
# spent 203µs making 42 calls to Class::MOP::Mixin::HasMethods::wrapped_method_metaclass, avg 5µs/call | ||
| 142 | attribute_metaclass | ||||
| 143 | method_metaclass | ||||
| 144 | wrapped_method_metaclass | ||||
| 145 | instance_metaclass | ||||
| 146 | constructor_class | ||||
| 147 | destructor_class | ||||
| 148 | error_class | ||||
| 149 | ); | ||||
| 150 | |||||
| 151 | $cache_key = _anon_cache_key( | ||||
| 152 | [ $meta->superclasses ], | ||||
| 153 | 42 | 1.81ms | [ map { $_->name } @{ $meta->roles } ], # spent 1.81ms making 42 calls to Class::MOP::Class::is_anon_class, avg 43µs/call | ||
| 154 | ) if $meta->is_anon_class; | ||||
| 155 | } | ||||
| 156 | |||||
| 157 | 42 | 555ms | my $new_meta = $self->SUPER::reinitialize( # spent 555ms making 42 calls to Class::MOP::Class::reinitialize, avg 13.2ms/call | ||
| 158 | $pkg, | ||||
| 159 | %existing_classes, | ||||
| 160 | @_, | ||||
| 161 | ); | ||||
| 162 | |||||
| 163 | return $new_meta unless defined $cache_key; | ||||
| 164 | |||||
| 165 | my $new_cache_key = _anon_cache_key( | ||||
| 166 | [ $meta->superclasses ], | ||||
| 167 | [ map { $_->name } @{ $meta->roles } ], | ||||
| 168 | ); | ||||
| 169 | |||||
| 170 | delete $ANON_CLASSES{$cache_key}; | ||||
| 171 | $ANON_CLASSES{$new_cache_key} = $new_meta; | ||||
| 172 | weaken($ANON_CLASSES{$new_cache_key}); | ||||
| 173 | |||||
| 174 | return $new_meta; | ||||
| 175 | } | ||||
| 176 | |||||
| 177 | # spent 6.22ms (3.71+2.51) within Moose::Meta::Class::add_role which was called 73 times, avg 85µs/call:
# 73 times (3.71ms+2.51ms) by Moose::Meta::Role::Application::ToClass::apply at line 33 of Moose/Meta/Role/Application/ToClass.pm, avg 85µs/call | ||||
| 178 | 219 | 4.53ms | my ($self, $role) = @_; | ||
| 179 | 146 | 1.01ms | (blessed($role) && $role->isa('Moose::Meta::Role')) # spent 535µs making 73 calls to Scalar::Util::blessed, avg 7µs/call
# spent 474µs making 73 calls to UNIVERSAL::isa, avg 6µs/call | ||
| 180 | || $self->throw_error("Roles must be instances of Moose::Meta::Role", data => $role); | ||||
| 181 | 73 | 1.50ms | push @{$self->roles} => $role; # spent 1.50ms making 73 calls to Moose::Meta::Class::roles, avg 21µs/call | ||
| 182 | } | ||||
| 183 | |||||
| 184 | sub role_applications { | ||||
| 185 | my ($self) = @_; | ||||
| 186 | |||||
| 187 | return @{$self->_get_role_applications}; | ||||
| 188 | } | ||||
| 189 | |||||
| 190 | # spent 5.31ms (3.45+1.86) within Moose::Meta::Class::add_role_application which was called 73 times, avg 73µs/call:
# 73 times (3.45ms+1.86ms) by Moose::Meta::Role::Application::ToClass::apply at line 34 of Moose/Meta/Role/Application/ToClass.pm, avg 73µs/call | ||||
| 191 | 219 | 4.15ms | my ($self, $application) = @_; | ||
| 192 | 146 | 838µs | (blessed($application) && $application->isa('Moose::Meta::Role::Application::ToClass')) # spent 426µs making 73 calls to UNIVERSAL::isa, avg 6µs/call
# spent 412µs making 73 calls to Scalar::Util::blessed, avg 6µs/call | ||
| 193 | || $self->throw_error("Role applications must be instances of Moose::Meta::Role::Application::ToClass", data => $application); | ||||
| 194 | 73 | 1.02ms | push @{$self->_get_role_applications} => $application; # spent 1.02ms making 73 calls to Moose::Meta::Class::_get_role_applications, avg 14µs/call | ||
| 195 | } | ||||
| 196 | |||||
| 197 | # spent 1.62ms (502µs+1.12) within Moose::Meta::Class::calculate_all_roles which was called 6 times, avg 271µs/call:
# 6 times (502µs+1.12ms) by Moose::Meta::Attribute::Native::Trait::_build_native_type at line 184 of Moose/Meta/Attribute/Native/Trait.pm, avg 271µs/call | ||||
| 198 | 18 | 228µs | my $self = shift; | ||
| 199 | my %seen; | ||||
| 200 | 18 | 311µs | 24 | 1.12ms | grep { !$seen{$_->name}++ } map { $_->calculate_all_roles } @{ $self->roles }; # spent 982µs making 6 calls to Moose::Meta::Role::calculate_all_roles, avg 164µs/call
# spent 80µs making 6 calls to Moose::Meta::Class::roles, avg 13µs/call
# spent 60µs making 12 calls to Class::MOP::Package::name, avg 5µs/call |
| 201 | } | ||||
| 202 | |||||
| 203 | sub calculate_all_roles_with_inheritance { | ||||
| 204 | my $self = shift; | ||||
| 205 | my %seen; | ||||
| 206 | grep { !$seen{$_->name}++ } | ||||
| 207 | map { Class::MOP::class_of($_)->can('calculate_all_roles') | ||||
| 208 | ? Class::MOP::class_of($_)->calculate_all_roles | ||||
| 209 | : () } | ||||
| 210 | $self->linearized_isa; | ||||
| 211 | } | ||||
| 212 | |||||
| 213 | # spent 38.7ms (6.99+31.7) within Moose::Meta::Class::does_role which was called 44 times, avg 879µs/call:
# 38 times (5.09ms+26.5ms) by List::MoreUtils::all at line 160 of Moose/Util/MetaRole.pm, avg 832µs/call
# 6 times (1.89ms+5.16ms) by Moose::Object::does at line 125 of Moose/Object.pm, avg 1.17ms/call | ||||
| 214 | 176 | 1.77ms | my ($self, $role_name) = @_; | ||
| 215 | |||||
| 216 | (defined $role_name) | ||||
| 217 | || $self->throw_error("You must supply a role name to look for"); | ||||
| 218 | |||||
| 219 | 44 | 25.6ms | foreach my $class ($self->class_precedence_list) { # spent 25.6ms making 44 calls to Class::MOP::Class::class_precedence_list, avg 581µs/call | ||
| 220 | 342 | 5.39ms | 130 | 3.65ms | my $meta = Class::MOP::class_of($class); # spent 3.65ms making 130 calls to Class::MOP::class_of, avg 28µs/call |
| 221 | # when a Moose metaclass is itself extended with a role, | ||||
| 222 | # this check needs to be done since some items in the | ||||
| 223 | # class_precedence_list might in fact be Class::MOP | ||||
| 224 | # based still. | ||||
| 225 | 130 | 841µs | next unless $meta && $meta->can('roles'); # spent 841µs making 130 calls to UNIVERSAL::can, avg 6µs/call | ||
| 226 | 82 | 1.07ms | foreach my $role (@{$meta->roles}) { # spent 1.07ms making 82 calls to Moose::Meta::Class::roles, avg 13µs/call | ||
| 227 | 6 | 106µs | 6 | 564µs | return 1 if $role->does_role($role_name); # spent 564µs making 6 calls to Moose::Meta::Role::does_role, avg 94µs/call |
| 228 | } | ||||
| 229 | } | ||||
| 230 | return 0; | ||||
| 231 | } | ||||
| 232 | |||||
| 233 | # spent 113ms (18.7+94.3) within Moose::Meta::Class::excludes_role which was called 73 times, avg 1.55ms/call:
# 73 times (18.7ms+94.3ms) by Moose::Meta::Role::Application::ToClass::check_role_exclusions at line 39 of Moose/Meta/Role/Application/ToClass.pm, avg 1.55ms/call | ||||
| 234 | 292 | 2.99ms | my ($self, $role_name) = @_; | ||
| 235 | |||||
| 236 | (defined $role_name) | ||||
| 237 | || $self->throw_error("You must supply a role name to look for"); | ||||
| 238 | |||||
| 239 | 73 | 73.9ms | foreach my $class ($self->class_precedence_list) { # spent 73.9ms making 73 calls to Class::MOP::Class::class_precedence_list, avg 1.01ms/call | ||
| 240 | 1036 | 15.5ms | 427 | 12.1ms | my $meta = Class::MOP::class_of($class); # spent 12.1ms making 427 calls to Class::MOP::class_of, avg 28µs/call |
| 241 | # when a Moose metaclass is itself extended with a role, | ||||
| 242 | # this check needs to be done since some items in the | ||||
| 243 | # class_precedence_list might in fact be Class::MOP | ||||
| 244 | # based still. | ||||
| 245 | 427 | 2.73ms | next unless $meta && $meta->can('roles'); # spent 2.73ms making 427 calls to UNIVERSAL::can, avg 6µs/call | ||
| 246 | 182 | 2.34ms | foreach my $role (@{$meta->roles}) { # spent 2.34ms making 182 calls to Moose::Meta::Class::roles, avg 13µs/call | ||
| 247 | 76 | 1.26ms | 76 | 3.15ms | return 1 if $role->excludes_role($role_name); # spent 3.15ms making 76 calls to Moose::Meta::Role::excludes_role, avg 41µs/call |
| 248 | } | ||||
| 249 | } | ||||
| 250 | return 0; | ||||
| 251 | } | ||||
| 252 | |||||
| 253 | # spent 396ms (29.4+366) within Moose::Meta::Class::new_object which was called 101 times, avg 3.92ms/call:
# 59 times (25.1ms+318ms) by Moose::Meta::Attribute::_new or Moose::Meta::Role::_new at line 4 of generated method (unknown origin), avg 5.81ms/call
# 42 times (4.22ms+48.5ms) by MooseX::Role::Parameterized::Meta::Role::Parameterizable::construct_parameters at line 68 of MooseX/Role/Parameterized/Meta/Role/Parameterizable.pm, avg 1.26ms/call | ||||
| 254 | 606 | 9.51ms | my $self = shift; | ||
| 255 | my $params = @_ == 1 ? $_[0] : {@_}; | ||||
| 256 | 101 | 330ms | my $object = $self->SUPER::new_object($params); # spent 330ms making 101 calls to Class::MOP::Class::new_object, avg 3.27ms/call | ||
| 257 | |||||
| 258 | 101 | 25.6ms | foreach my $attr ( $self->get_all_attributes() ) { # spent 22.8ms making 57 calls to Class::MOP::Class::get_all_attributes, avg 400µs/call
# spent 2.78ms making 44 calls to Class::MOP::Class::Immutable::Moose::Meta::Class::get_all_attributes, avg 63µs/call | ||
| 259 | |||||
| 260 | 1498 | 27.9ms | 1608 | 9.01ms | next unless $attr->can('has_trigger') && $attr->has_trigger; # spent 7.86ms making 1498 calls to UNIVERSAL::can, avg 5µs/call
# spent 1.15ms making 110 calls to Moose::Meta::Mixin::AttributeCore::has_trigger, avg 10µs/call |
| 261 | |||||
| 262 | my $init_arg = $attr->init_arg; | ||||
| 263 | |||||
| 264 | next unless defined $init_arg; | ||||
| 265 | |||||
| 266 | next unless exists $params->{$init_arg}; | ||||
| 267 | |||||
| 268 | $attr->trigger->( | ||||
| 269 | $object, | ||||
| 270 | ( | ||||
| 271 | $attr->should_coerce | ||||
| 272 | ? $attr->get_read_method_ref->($object) | ||||
| 273 | : $params->{$init_arg} | ||||
| 274 | ), | ||||
| 275 | ); | ||||
| 276 | } | ||||
| 277 | |||||
| 278 | 143 | 1.94ms | $object->BUILDALL($params) if $object->can('BUILDALL'); # spent 1.05ms making 42 calls to Moose::Object::BUILDALL, avg 25µs/call
# spent 894µs making 101 calls to UNIVERSAL::can, avg 9µs/call | ||
| 279 | |||||
| 280 | return $object; | ||||
| 281 | } | ||||
| 282 | |||||
| 283 | # spent 807µs within Moose::Meta::Class::_generate_fallback_constructor which was called 42 times, avg 19µs/call:
# 42 times (807µs+0s) by Class::MOP::Class::_inline_fallback_constructor at line 607 of Class/MOP/Class.pm, avg 19µs/call | ||||
| 284 | 126 | 926µs | my $self = shift; | ||
| 285 | my ($class) = @_; | ||||
| 286 | return $class . '->Moose::Object::new(@_)' | ||||
| 287 | } | ||||
| 288 | |||||
| 289 | # spent 37.9ms (1.33+36.5) within Moose::Meta::Class::_inline_params which was called 42 times, avg 902µs/call:
# 42 times (1.33ms+36.5ms) by Class::MOP::Class::_inline_new_object at line 591 of Class/MOP/Class.pm, avg 902µs/call | ||||
| 290 | 126 | 1.36ms | my $self = shift; | ||
| 291 | my ($params, $class) = @_; | ||||
| 292 | return ( | ||||
| 293 | 42 | 36.5ms | 'my ' . $params . ' = ', # spent 36.5ms making 42 calls to Moose::Meta::Class::_inline_BUILDARGS, avg 870µs/call | ||
| 294 | $self->_inline_BUILDARGS($class, '@_'), | ||||
| 295 | ';', | ||||
| 296 | ); | ||||
| 297 | } | ||||
| 298 | |||||
| 299 | # spent 36.5ms (3.47+33.1) within Moose::Meta::Class::_inline_BUILDARGS which was called 42 times, avg 870µs/call:
# 42 times (3.47ms+33.1ms) by Moose::Meta::Class::_inline_params at line 293, avg 870µs/call | ||||
| 300 | 168 | 3.57ms | my $self = shift; | ||
| 301 | my ($class, $args) = @_; | ||||
| 302 | |||||
| 303 | 42 | 31.9ms | my $buildargs = $self->find_method_by_name("BUILDARGS"); # spent 31.9ms making 42 calls to Class::MOP::Class::find_method_by_name, avg 760µs/call | ||
| 304 | |||||
| 305 | 81 | 1.14ms | if ($args eq '@_' # spent 811µs making 42 calls to Moose::Meta::Class::_inline_throw_error, avg 19µs/call
# spent 332µs making 39 calls to Class::MOP::Method::body, avg 9µs/call | ||
| 306 | && (!$buildargs or $buildargs->body == \&Moose::Object::BUILDARGS)) { | ||||
| 307 | return ( | ||||
| 308 | 'do {', | ||||
| 309 | 'my $params;', | ||||
| 310 | 'if (scalar @_ == 1) {', | ||||
| 311 | 'if (!defined($_[0]) || ref($_[0]) ne \'HASH\') {', | ||||
| 312 | $self->_inline_throw_error( | ||||
| 313 | '"Single parameters to new() must be a HASH ref"', | ||||
| 314 | 'data => $_[0]', | ||||
| 315 | ) . ';', | ||||
| 316 | '}', | ||||
| 317 | '$params = { %{ $_[0] } };', | ||||
| 318 | '}', | ||||
| 319 | 'elsif (@_ % 2) {', | ||||
| 320 | 'Carp::carp(', | ||||
| 321 | '"The new() method for ' . $class . ' expects a ' | ||||
| 322 | . 'hash reference or a key/value list. You passed an ' | ||||
| 323 | . 'odd number of arguments"', | ||||
| 324 | ');', | ||||
| 325 | '$params = {@_, undef};', | ||||
| 326 | '}', | ||||
| 327 | 'else {', | ||||
| 328 | '$params = {@_};', | ||||
| 329 | '}', | ||||
| 330 | '$params;', | ||||
| 331 | '}', | ||||
| 332 | ); | ||||
| 333 | } | ||||
| 334 | else { | ||||
| 335 | return $class . '->BUILDARGS(' . $args . ')'; | ||||
| 336 | } | ||||
| 337 | } | ||||
| 338 | |||||
| 339 | # spent 118ms (8.83+109) within Moose::Meta::Class::_inline_slot_initializer which was called 132 times, avg 893µs/call:
# 132 times (8.83ms+109ms) by Class::MOP::Class::_inline_slot_initializers at line 645 of Class/MOP/Class.pm, avg 893µs/call | ||||
| 340 | 396 | 9.12ms | my $self = shift; | ||
| 341 | my ($attr, $idx) = @_; | ||||
| 342 | |||||
| 343 | return ( | ||||
| 344 | 396 | 109ms | '## ' . $attr->name, # spent 97.1ms making 132 calls to Class::MOP::Class::_inline_slot_initializer, avg 735µs/call
# spent 11.3ms making 132 calls to Moose::Meta::Class::_inline_check_required_attr, avg 85µs/call
# spent 760µs making 132 calls to Class::MOP::Mixin::AttributeCore::name, avg 6µs/call | ||
| 345 | $self->_inline_check_required_attr($attr), | ||||
| 346 | $self->SUPER::_inline_slot_initializer(@_), | ||||
| 347 | ); | ||||
| 348 | } | ||||
| 349 | |||||
| 350 | # spent 11.3ms (7.55+3.71) within Moose::Meta::Class::_inline_check_required_attr which was called 132 times, avg 85µs/call:
# 132 times (7.55ms+3.71ms) by Moose::Meta::Class::_inline_slot_initializer at line 344, avg 85µs/call | ||||
| 351 | 566 | 9.35ms | my $self = shift; | ||
| 352 | my ($attr) = @_; | ||||
| 353 | |||||
| 354 | 132 | 754µs | return unless defined $attr->init_arg; # spent 754µs making 132 calls to Class::MOP::Mixin::AttributeCore::init_arg, avg 6µs/call | ||
| 355 | 162 | 1.62ms | return unless $attr->can('is_required') && $attr->is_required; # spent 934µs making 114 calls to UNIVERSAL::can, avg 8µs/call
# spent 689µs making 48 calls to Moose::Meta::Mixin::AttributeCore::is_required, avg 14µs/call | ||
| 356 | 56 | 610µs | return if $attr->has_default || $attr->has_builder; # spent 308µs making 28 calls to Class::MOP::Mixin::AttributeCore::has_default, avg 11µs/call
# spent 302µs making 28 calls to Class::MOP::Mixin::AttributeCore::has_builder, avg 11µs/call | ||
| 357 | |||||
| 358 | return ( | ||||
| 359 | 84 | 720µs | 'if (!exists $params->{\'' . $attr->init_arg . '\'}) {', # spent 454µs making 28 calls to Moose::Meta::Class::_inline_throw_error, avg 16µs/call
# spent 141µs making 28 calls to Class::MOP::Mixin::AttributeCore::init_arg, avg 5µs/call
# spent 126µs making 28 calls to Class::MOP::Mixin::AttributeCore::name, avg 4µs/call | ||
| 360 | $self->_inline_throw_error( | ||||
| 361 | '"Attribute (' . quotemeta($attr->name) . ') is required"' | ||||
| 362 | ) . ';', | ||||
| 363 | '}', | ||||
| 364 | ); | ||||
| 365 | } | ||||
| 366 | |||||
| 367 | # XXX: these two are duplicated from cmop, because we have to pass the tc stuff | ||||
| 368 | # through to _inline_set_value - this should probably be fixed, but i'm not | ||||
| 369 | # quite sure how. -doy | ||||
| 370 | # spent 49.8ms (8.03+41.8) within Moose::Meta::Class::_inline_init_attr_from_constructor which was called 114 times, avg 437µs/call:
# 114 times (8.03ms+41.8ms) by Class::MOP::Class::_inline_slot_initializer at line 654 of Class/MOP/Class.pm, avg 437µs/call | ||||
| 371 | 570 | 7.99ms | my $self = shift; | ||
| 372 | my ($attr, $idx) = @_; | ||||
| 373 | |||||
| 374 | 228 | 40.4ms | my @initial_value = $attr->_inline_set_value( # spent 26.2ms making 48 calls to Moose::Meta::Attribute::_inline_set_value, avg 545µs/call
# spent 13.6ms making 66 calls to Class::MOP::Attribute::_inline_set_value, avg 207µs/call
# spent 594µs making 114 calls to Class::MOP::Mixin::AttributeCore::init_arg, avg 5µs/call | ||
| 375 | '$instance', | ||||
| 376 | '$params->{\'' . $attr->init_arg . '\'}', | ||||
| 377 | '$type_constraint_bodies[' . $idx . ']', | ||||
| 378 | '$type_constraints[' . $idx . ']', | ||||
| 379 | 'for constructor', | ||||
| 380 | ); | ||||
| 381 | |||||
| 382 | 114 | 1.37ms | push @initial_value, ( # spent 1.37ms making 114 calls to Class::MOP::Mixin::AttributeCore::has_initializer, avg 12µs/call | ||
| 383 | '$attrs->[' . $idx . ']->set_initial_value(', | ||||
| 384 | '$instance,', | ||||
| 385 | $attr->_inline_instance_get('$instance'), | ||||
| 386 | ');', | ||||
| 387 | ) if $attr->has_initializer; | ||||
| 388 | |||||
| 389 | return @initial_value; | ||||
| 390 | } | ||||
| 391 | |||||
| 392 | # spent 36.5ms (7.05+29.5) within Moose::Meta::Class::_inline_init_attr_from_default which was called 132 times, avg 277µs/call:
# 114 times (5.64ms+21.2ms) by Class::MOP::Class::_inline_slot_initializer at line 659 of Class/MOP/Class.pm, avg 236µs/call
# 18 times (1.40ms+8.25ms) by Class::MOP::Class::_inline_slot_initializer at line 653 of Class/MOP/Class.pm, avg 536µs/call | ||||
| 393 | 726 | 6.43ms | my $self = shift; | ||
| 394 | my ($attr, $idx) = @_; | ||||
| 395 | |||||
| 396 | 132 | 9.30ms | my $default = $self->_inline_default_value($attr, $idx); # spent 9.30ms making 132 calls to Class::MOP::Class::_inline_default_value, avg 70µs/call | ||
| 397 | return unless $default; | ||||
| 398 | |||||
| 399 | 66 | 19.5ms | my @initial_value = ( # spent 11.7ms making 22 calls to Moose::Meta::Attribute::_inline_set_value, avg 533µs/call
# spent 7.78ms making 44 calls to Class::MOP::Attribute::_inline_set_value, avg 177µs/call | ||
| 400 | 'my $default = ' . $default . ';', | ||||
| 401 | $attr->_inline_set_value( | ||||
| 402 | '$instance', | ||||
| 403 | '$default', | ||||
| 404 | '$type_constraint_bodies[' . $idx . ']', | ||||
| 405 | '$type_constraints[' . $idx . ']', | ||||
| 406 | 'for constructor', | ||||
| 407 | ), | ||||
| 408 | ); | ||||
| 409 | |||||
| 410 | 66 | 670µs | push @initial_value, ( # spent 670µs making 66 calls to Class::MOP::Mixin::AttributeCore::has_initializer, avg 10µs/call | ||
| 411 | '$attrs->[' . $idx . ']->set_initial_value(', | ||||
| 412 | '$instance,', | ||||
| 413 | $attr->_inline_instance_get('$instance'), | ||||
| 414 | ');', | ||||
| 415 | ) if $attr->has_initializer; | ||||
| 416 | |||||
| 417 | return @initial_value; | ||||
| 418 | } | ||||
| 419 | |||||
| 420 | # spent 86.6ms (1.55+85.1) within Moose::Meta::Class::_inline_extra_init which was called 42 times, avg 2.06ms/call:
# 42 times (1.55ms+85.1ms) by Class::MOP::Class::_inline_new_object at line 591 of Class/MOP/Class.pm, avg 2.06ms/call | ||||
| 421 | 84 | 1.47ms | my $self = shift; | ||
| 422 | return ( | ||||
| 423 | 84 | 85.1ms | $self->_inline_triggers, # spent 46.8ms making 37 calls to Class::MOP::Class::__ANON__::SERIAL::2::_inline_BUILDALL, avg 1.27ms/call
# spent 31.1ms making 42 calls to Moose::Meta::Class::_inline_triggers, avg 741µs/call
# spent 7.13ms making 5 calls to Moose::Meta::Class::_inline_BUILDALL, avg 1.43ms/call | ||
| 424 | $self->_inline_BUILDALL, | ||||
| 425 | ); | ||||
| 426 | } | ||||
| 427 | |||||
| 428 | # spent 31.1ms (5.51+25.6) within Moose::Meta::Class::_inline_triggers which was called 42 times, avg 741µs/call:
# 42 times (5.51ms+25.6ms) by Moose::Meta::Class::_inline_extra_init at line 423, avg 741µs/call | ||||
| 429 | 530 | 11.7ms | my $self = shift; | ||
| 430 | my @trigger_calls; | ||||
| 431 | |||||
| 432 | 724 | 27.1ms | my @attrs = sort { $a->name cmp $b->name } $self->get_all_attributes; # spent 14.9ms making 42 calls to Class::MOP::Class::get_all_attributes, avg 354µs/call
# spent 9.29ms making 42 calls to Moose::Meta::Class::CORE:sort, avg 221µs/call
# spent 2.90ms making 640 calls to Class::MOP::Mixin::AttributeCore::name, avg 5µs/call | ||
| 433 | for my $i (0 .. $#attrs) { | ||||
| 434 | 264 | 3.70ms | my $attr = $attrs[$i]; | ||
| 435 | |||||
| 436 | 192 | 1.48ms | next unless $attr->can('has_trigger') && $attr->has_trigger; # spent 841µs making 132 calls to UNIVERSAL::can, avg 6µs/call
# spent 636µs making 60 calls to Moose::Meta::Mixin::AttributeCore::has_trigger, avg 11µs/call | ||
| 437 | |||||
| 438 | my $init_arg = $attr->init_arg; | ||||
| 439 | next unless defined $init_arg; | ||||
| 440 | |||||
| 441 | push @trigger_calls, | ||||
| 442 | 'if (exists $params->{\'' . $init_arg . '\'}) {', | ||||
| 443 | '$attrs->[' . $i . ']->trigger->(', | ||||
| 444 | '$instance,', | ||||
| 445 | $attr->_inline_instance_get('$instance') . ',', | ||||
| 446 | ');', | ||||
| 447 | '}'; | ||||
| 448 | } | ||||
| 449 | |||||
| 450 | return @trigger_calls; | ||||
| 451 | } | ||||
| 452 | |||||
| 453 | # spent 36.1ms (1.42+34.7) within Moose::Meta::Class::_inline_BUILDALL which was called 42 times, avg 859µs/call:
# 37 times (1.24ms+27.7ms) by Class::MOP::Class:::around at line 18 of MooseX/StrictConstructor/Role/Meta/Class.pm, avg 782µs/call
# 5 times (186µs+6.95ms) by Moose::Meta::Class::_inline_extra_init at line 423, avg 1.43ms/call | ||||
| 454 | 210 | 1.44ms | my $self = shift; | ||
| 455 | |||||
| 456 | 42 | 34.7ms | my @methods = reverse $self->find_all_methods_by_name('BUILD'); # spent 34.7ms making 42 calls to Class::MOP::Class::find_all_methods_by_name, avg 825µs/call | ||
| 457 | my @BUILD_calls; | ||||
| 458 | |||||
| 459 | foreach my $method (@methods) { | ||||
| 460 | 1 | 14µs | push @BUILD_calls, | ||
| 461 | '$instance->' . $method->{class} . '::BUILD($params);'; | ||||
| 462 | } | ||||
| 463 | |||||
| 464 | return @BUILD_calls; | ||||
| 465 | } | ||||
| 466 | |||||
| 467 | # spent 710ms (55.1+655) within Moose::Meta::Class::superclasses which was called 789 times, avg 900µs/call:
# 264 times (14.9ms+34.3ms) by Class::MOP::Class::class_precedence_list at line 1070 of Class/MOP/Class.pm, avg 186µs/call
# 220 times (13.8ms+18.1ms) by Class::MOP::Class::_check_metaclass_compatibility at line 201 of Class/MOP/Class.pm, avg 145µs/call
# 109 times (7.10ms+-7.10ms) by Class::MOP::Class::_superclasses_updated at line 1011 of Class/MOP/Class.pm, avg 0s/call
# 90 times (8.20ms+241ms) by Moose::init_meta at line 218 of Moose.pm, avg 2.77ms/call
# 42 times (2.92ms+6.06ms) by Moose::Util::MetaRole::apply_base_class_roles at line 140 of Moose/Util/MetaRole.pm, avg 214µs/call
# 38 times (4.41ms+195ms) by Moose::Util::MetaRole::apply_base_class_roles at line 146 of Moose/Util/MetaRole.pm, avg 5.25ms/call
# 23 times (3.38ms+153ms) by Class::MOP::Class::create at line 520 of Class/MOP/Class.pm, avg 6.78ms/call
# 3 times (351µs+14.7ms) by Moose::extends at line 54 of Moose.pm, avg 5.02ms/call | ||||
| 468 | 3156 | 46.6ms | my $self = shift; | ||
| 469 | 789 | 30.4ms | my $supers = Data::OptList::mkopt(\@_); # spent 30.4ms making 789 calls to Data::OptList::mkopt, avg 39µs/call | ||
| 470 | foreach my $super (@{ $supers }) { | ||||
| 471 | 484 | 7.38ms | my ($name, $opts) = @{ $super }; | ||
| 472 | 121 | 24.9ms | Class::MOP::load_class($name, $opts); # spent 27.1ms making 121 calls to Class::MOP::load_class, avg 224µs/call, recursion: max depth 2, sum of overlapping time 2.20ms | ||
| 473 | 121 | 4.15ms | my $meta = Class::MOP::class_of($name); # spent 4.15ms making 121 calls to Class::MOP::class_of, avg 34µs/call | ||
| 474 | 120 | 1.60ms | $self->throw_error("You cannot inherit from a Moose Role ($name)") # spent 1.60ms making 120 calls to UNIVERSAL::isa, avg 13µs/call | ||
| 475 | if $meta && $meta->isa('Moose::Meta::Role') | ||||
| 476 | } | ||||
| 477 | 789 | 613ms | return $self->SUPER::superclasses(map { $_->[0] } @{ $supers }); # spent 635ms making 789 calls to Class::MOP::Class::superclasses, avg 805µs/call, recursion: max depth 1, sum of overlapping time 22.4ms | ||
| 478 | } | ||||
| 479 | |||||
| 480 | ### --------------------------------------------- | ||||
| 481 | |||||
| 482 | # spent 2.65s (7.43ms+2.65) within Moose::Meta::Class::add_attribute which was called 72 times, avg 36.9ms/call:
# 50 times (5.28ms+2.57s) by Moose::has at line 70 of Moose.pm, avg 51.5ms/call
# 21 times (2.01ms+67.0ms) by Moose::Meta::Role::Application::ToClass::apply_attributes at line 142 of Moose/Meta/Role/Application/ToClass.pm, avg 3.29ms/call
# once (146µs+9.08ms) by MooseX::Role::Parameterized::Meta::Role::Parameterizable::add_parameter at line 55 of MooseX/Role/Parameterized/Meta/Role/Parameterizable.pm | ||||
| 483 | 360 | 8.58ms | my $self = shift; | ||
| 484 | 144 | 624ms | my $attr = # spent 624ms making 51 calls to Moose::Meta::Class::_process_attribute, avg 12.2ms/call
# spent 389µs making 72 calls to Scalar::Util::blessed, avg 5µs/call
# spent 153µs making 21 calls to UNIVERSAL::isa, avg 7µs/call | ||
| 485 | (blessed $_[0] && $_[0]->isa('Class::MOP::Attribute') | ||||
| 486 | ? $_[0] | ||||
| 487 | : $self->_process_attribute(@_)); | ||||
| 488 | 72 | 2.09s | $self->SUPER::add_attribute($attr); # spent 2.09s making 72 calls to Class::MOP::Mixin::HasAttributes::add_attribute, avg 29.1ms/call | ||
| 489 | # it may be a Class::MOP::Attribute, theoretically, which doesn't have | ||||
| 490 | # 'bare' and doesn't implement this method | ||||
| 491 | 143 | 3.09ms | if ($attr->can('_check_associated_methods')) { # spent 2.16ms making 71 calls to Moose::Meta::Attribute::_check_associated_methods, avg 30µs/call
# spent 929µs making 72 calls to UNIVERSAL::can, avg 13µs/call | ||
| 492 | $attr->_check_associated_methods; | ||||
| 493 | } | ||||
| 494 | return $attr; | ||||
| 495 | } | ||||
| 496 | |||||
| 497 | # spent 46.0ms (1.99+44.0) within Moose::Meta::Class::add_override_method_modifier which was called 36 times, avg 1.28ms/call:
# 36 times (1.99ms+44.0ms) by Moose::Meta::Role::Application::ToClass::apply_override_method_modifiers at line 208 of Moose/Meta/Role/Application/ToClass.pm, avg 1.28ms/call | ||||
| 498 | 108 | 1.81ms | my ($self, $name, $method, $_super_package) = @_; | ||
| 499 | |||||
| 500 | 36 | 5.02ms | (!$self->has_method($name)) # spent 5.02ms making 36 calls to Class::MOP::Mixin::HasMethods::has_method, avg 139µs/call | ||
| 501 | || $self->throw_error("Cannot add an override method if a local method is already present"); | ||||
| 502 | |||||
| 503 | 72 | 39.0ms | $self->add_method($name => Moose::Meta::Method::Overridden->new( # spent 23.9ms making 36 calls to Moose::Meta::Method::Overridden::new, avg 663µs/call
# spent 15.1ms making 36 calls to Class::MOP::Mixin::HasMethods::add_method, avg 420µs/call | ||
| 504 | method => $method, | ||||
| 505 | class => $self, | ||||
| 506 | package => $_super_package, # need this for roles | ||||
| 507 | name => $name, | ||||
| 508 | )); | ||||
| 509 | } | ||||
| 510 | |||||
| 511 | sub add_augment_method_modifier { | ||||
| 512 | my ($self, $name, $method) = @_; | ||||
| 513 | (!$self->has_method($name)) | ||||
| 514 | || $self->throw_error("Cannot add an augment method if a local method is already present"); | ||||
| 515 | |||||
| 516 | $self->add_method($name => Moose::Meta::Method::Augmented->new( | ||||
| 517 | method => $method, | ||||
| 518 | class => $self, | ||||
| 519 | name => $name, | ||||
| 520 | )); | ||||
| 521 | } | ||||
| 522 | |||||
| 523 | ## Private Utility methods ... | ||||
| 524 | |||||
| 525 | sub _find_next_method_by_name_which_is_not_overridden { | ||||
| 526 | my ($self, $name) = @_; | ||||
| 527 | foreach my $method ($self->find_all_methods_by_name($name)) { | ||||
| 528 | return $method->{code} | ||||
| 529 | if blessed($method->{code}) && !$method->{code}->isa('Moose::Meta::Method::Overridden'); | ||||
| 530 | } | ||||
| 531 | return undef; | ||||
| 532 | } | ||||
| 533 | |||||
| 534 | ## Metaclass compatibility | ||||
| 535 | |||||
| 536 | # spent 70.5ms (47.2+23.3) within Moose::Meta::Class::_base_metaclasses which was called 314 times, avg 224µs/call:
# 163 times (24.8ms+12.4ms) by Class::MOP::Class::_can_fix_metaclass_incompatibility at line 331 of Class/MOP/Class.pm, avg 228µs/call
# 151 times (22.4ms+10.9ms) by Class::MOP::Class::_check_metaclass_compatibility at line 206 of Class/MOP/Class.pm, avg 220µs/call | ||||
| 537 | 1256 | 22.6ms | my $self = shift; | ||
| 538 | 314 | 5.93ms | my %metaclasses = $self->SUPER::_base_metaclasses; # spent 5.93ms making 314 calls to Class::MOP::Class::_base_metaclasses, avg 19µs/call | ||
| 539 | for my $class (keys %metaclasses) { | ||||
| 540 | 1884 | 41.3ms | 1884 | 17.4ms | $metaclasses{$class} =~ s/^Class::MOP/Moose::Meta/; # spent 17.4ms making 1884 calls to Moose::Meta::Class::CORE:subst, avg 9µs/call |
| 541 | } | ||||
| 542 | return ( | ||||
| 543 | %metaclasses, | ||||
| 544 | error_class => 'Moose::Error::Default', | ||||
| 545 | ); | ||||
| 546 | } | ||||
| 547 | |||||
| 548 | sub _fix_class_metaclass_incompatibility { | ||||
| 549 | my $self = shift; | ||||
| 550 | my ($super_meta) = @_; | ||||
| 551 | |||||
| 552 | $self->SUPER::_fix_class_metaclass_incompatibility(@_); | ||||
| 553 | |||||
| 554 | if ($self->_class_metaclass_can_be_made_compatible($super_meta)) { | ||||
| 555 | ($self->is_pristine) | ||||
| 556 | || confess "Can't fix metaclass incompatibility for " | ||||
| 557 | . $self->name | ||||
| 558 | . " because it is not pristine."; | ||||
| 559 | my $super_meta_name = $super_meta->_real_ref_name; | ||||
| 560 | my $class_meta_subclass_meta_name = Moose::Util::_reconcile_roles_for_metaclass(blessed($self), $super_meta_name); | ||||
| 561 | my $new_self = $class_meta_subclass_meta_name->reinitialize( | ||||
| 562 | $self->name, | ||||
| 563 | ); | ||||
| 564 | |||||
| 565 | $self->_replace_self( $new_self, $class_meta_subclass_meta_name ); | ||||
| 566 | } | ||||
| 567 | } | ||||
| 568 | |||||
| 569 | sub _fix_single_metaclass_incompatibility { | ||||
| 570 | my $self = shift; | ||||
| 571 | my ($metaclass_type, $super_meta) = @_; | ||||
| 572 | |||||
| 573 | $self->SUPER::_fix_single_metaclass_incompatibility(@_); | ||||
| 574 | |||||
| 575 | if ($self->_single_metaclass_can_be_made_compatible($super_meta, $metaclass_type)) { | ||||
| 576 | ($self->is_pristine) | ||||
| 577 | || confess "Can't fix metaclass incompatibility for " | ||||
| 578 | . $self->name | ||||
| 579 | . " because it is not pristine."; | ||||
| 580 | my $super_meta_name = $super_meta->_real_ref_name; | ||||
| 581 | my $class_specific_meta_subclass_meta_name = Moose::Util::_reconcile_roles_for_metaclass($self->$metaclass_type, $super_meta->$metaclass_type); | ||||
| 582 | my $new_self = $super_meta->reinitialize( | ||||
| 583 | $self->name, | ||||
| 584 | $metaclass_type => $class_specific_meta_subclass_meta_name, | ||||
| 585 | ); | ||||
| 586 | |||||
| 587 | $self->_replace_self( $new_self, $super_meta_name ); | ||||
| 588 | } | ||||
| 589 | } | ||||
| 590 | |||||
| 591 | sub _replace_self { | ||||
| 592 | my $self = shift; | ||||
| 593 | my ( $new_self, $new_class) = @_; | ||||
| 594 | |||||
| 595 | %$self = %$new_self; | ||||
| 596 | bless $self, $new_class; | ||||
| 597 | |||||
| 598 | # We need to replace the cached metaclass instance or else when it goes | ||||
| 599 | # out of scope Class::MOP::Class destroy's the namespace for the | ||||
| 600 | # metaclass's class, causing much havoc. | ||||
| 601 | my $weaken = Class::MOP::metaclass_is_weak( $self->name ); | ||||
| 602 | Class::MOP::store_metaclass_by_name( $self->name, $self ); | ||||
| 603 | Class::MOP::weaken_metaclass( $self->name ) if $weaken; | ||||
| 604 | } | ||||
| 605 | |||||
| 606 | # spent 624ms (2.71+621) within Moose::Meta::Class::_process_attribute which was called 51 times, avg 12.2ms/call:
# 51 times (2.71ms+621ms) by Moose::Meta::Class::add_attribute at line 484, avg 12.2ms/call | ||||
| 607 | 153 | 1.59ms | my ( $self, $name, @args ) = @_; | ||
| 608 | |||||
| 609 | @args = %{$args[0]} if scalar @args == 1 && ref($args[0]) eq 'HASH'; | ||||
| 610 | |||||
| 611 | 51 | 1.40ms | 51 | 283µs | if (($name || '') =~ /^\+(.*)/) { # spent 283µs making 51 calls to Moose::Meta::Class::CORE:match, avg 6µs/call |
| 612 | 1 | 2.43ms | return $self->_process_inherited_attribute($1, @args); # spent 2.43ms making 1 call to Moose::Meta::Class::_process_inherited_attribute | ||
| 613 | } | ||||
| 614 | else { | ||||
| 615 | 50 | 618ms | return $self->_process_new_attribute($name, @args); # spent 618ms making 50 calls to Moose::Meta::Class::_process_new_attribute, avg 12.4ms/call | ||
| 616 | } | ||||
| 617 | } | ||||
| 618 | |||||
| 619 | # spent 618ms (2.73+616) within Moose::Meta::Class::_process_new_attribute which was called 50 times, avg 12.4ms/call:
# 50 times (2.73ms+616ms) by Moose::Meta::Class::_process_attribute at line 615, avg 12.4ms/call | ||||
| 620 | 100 | 3.00ms | my ( $self, $name, @args ) = @_; | ||
| 621 | |||||
| 622 | 100 | 616ms | $self->attribute_metaclass->interpolate_class_and_new($name, @args); # spent 615ms making 50 calls to Moose::Meta::Attribute::interpolate_class_and_new, avg 12.3ms/call
# spent 398µs making 50 calls to Class::MOP::Mixin::HasAttributes::attribute_metaclass, avg 8µs/call | ||
| 623 | } | ||||
| 624 | |||||
| 625 | # spent 2.43ms (115µs+2.31) within Moose::Meta::Class::_process_inherited_attribute which was called:
# once (115µs+2.31ms) by Moose::Meta::Class::_process_attribute at line 612 | ||||
| 626 | 4 | 79µs | my ($self, $attr_name, %options) = @_; | ||
| 627 | 1 | 800µs | my $inherited_attr = $self->find_attribute_by_name($attr_name); # spent 800µs making 1 call to Class::MOP::Class::find_attribute_by_name | ||
| 628 | (defined $inherited_attr) | ||||
| 629 | || $self->throw_error("Could not find an attribute by the name of '$attr_name' to inherit from in ${\$self->name}", data => $attr_name); | ||||
| 630 | 1 | 39µs | 1 | 14µs | if ($inherited_attr->isa('Moose::Meta::Attribute')) { # spent 14µs making 1 call to UNIVERSAL::isa |
| 631 | return $inherited_attr->clone_and_inherit_options(%options); | ||||
| 632 | } | ||||
| 633 | else { | ||||
| 634 | # NOTE: | ||||
| 635 | # kind of a kludge to handle Class::MOP::Attributes | ||||
| 636 | 1 | 1.50ms | return $inherited_attr->Moose::Meta::Attribute::clone_and_inherit_options(%options); # spent 1.50ms making 1 call to Moose::Meta::Attribute::clone_and_inherit_options | ||
| 637 | } | ||||
| 638 | } | ||||
| 639 | |||||
| 640 | ## Immutability | ||||
| 641 | |||||
| 642 | # spent 7.61ms (1.88+5.73) within Moose::Meta::Class::_immutable_options which was called 43 times, avg 177µs/call:
# 43 times (1.88ms+5.73ms) by Class::MOP::Class::make_immutable at line 1321 of Class/MOP/Class.pm, avg 177µs/call | ||||
| 643 | 86 | 1.77ms | my ( $self, @args ) = @_; | ||
| 644 | |||||
| 645 | 43 | 5.73ms | $self->SUPER::_immutable_options( # spent 5.73ms making 43 calls to Class::MOP::Class::_immutable_options, avg 133µs/call | ||
| 646 | inline_destructor => 1, | ||||
| 647 | |||||
| 648 | # Moose always does this when an attribute is created | ||||
| 649 | inline_accessors => 0, | ||||
| 650 | |||||
| 651 | @args, | ||||
| 652 | ); | ||||
| 653 | } | ||||
| 654 | |||||
| 655 | ## ------------------------------------------------- | ||||
| 656 | |||||
| 657 | 1 | 2µs | our $error_level; | ||
| 658 | |||||
| 659 | sub throw_error { | ||||
| 660 | my ( $self, @args ) = @_; | ||||
| 661 | local $error_level = ($error_level || 0) + 1; | ||||
| 662 | $self->raise_error($self->create_error(@args)); | ||||
| 663 | } | ||||
| 664 | |||||
| 665 | sub _inline_throw_error { | ||||
| 666 | 140 | 1.53ms | my ( $self, $msg, $args ) = @_; | ||
| 667 | "\$meta->throw_error($msg" . ($args ? ", $args" : "") . ")"; # FIXME makes deparsing *REALLY* hard | ||||
| 668 | } | ||||
| 669 | |||||
| 670 | sub raise_error { | ||||
| 671 | my ( $self, @args ) = @_; | ||||
| 672 | die @args; | ||||
| 673 | } | ||||
| 674 | |||||
| 675 | sub create_error { | ||||
| 676 | my ( $self, @args ) = @_; | ||||
| 677 | |||||
| 678 | require Carp::Heavy; | ||||
| 679 | |||||
| 680 | local $error_level = ($error_level || 0 ) + 1; | ||||
| 681 | |||||
| 682 | if ( @args % 2 == 1 ) { | ||||
| 683 | unshift @args, "message"; | ||||
| 684 | } | ||||
| 685 | |||||
| 686 | my %args = ( metaclass => $self, last_error => $@, @args ); | ||||
| 687 | |||||
| 688 | $args{depth} += $error_level; | ||||
| 689 | |||||
| 690 | my $class = ref $self ? $self->error_class : "Moose::Error::Default"; | ||||
| 691 | |||||
| 692 | Class::MOP::load_class($class); | ||||
| 693 | |||||
| 694 | $class->new( | ||||
| 695 | Carp::caller_info($args{depth}), | ||||
| 696 | %args | ||||
| 697 | ); | ||||
| 698 | } | ||||
| 699 | |||||
| 700 | 1 | 62µs | 1; | ||
| 701 | |||||
| 702 | __END__ | ||||
# spent 283µs within Moose::Meta::Class::CORE:match which was called 51 times, avg 6µs/call:
# 51 times (283µs+0s) by Moose::Meta::Class::_process_attribute at line 611, avg 6µs/call | |||||
sub Moose::Meta::Class::CORE:sort; # opcode | |||||
# spent 17.4ms within Moose::Meta::Class::CORE:subst which was called 1884 times, avg 9µs/call:
# 1884 times (17.4ms+0s) by Moose::Meta::Class::_base_metaclasses at line 540, avg 9µs/call |