| Filename | /home/doy/perl5/perlbrew/perls/perl-5.10.1/lib/site_perl/5.10.1/x86_64-linux/Class/MOP/Class.pm |
| Statements | Executed 114768 statements in 1.40s |
| Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
|---|---|---|---|---|---|
| 6454 | 25 | 13 | 213ms | 1.03s | Class::MOP::Class::initialize (recurses: max depth 1, inclusive time 10.1ms) |
| 440 | 2 | 1 | 153ms | 1.01s | Class::MOP::Class::_construct_instance |
| 1392 | 1 | 1 | 126ms | 239ms | Class::MOP::Class::_single_metaclass_can_be_made_compatible |
| 608 | 7 | 6 | 121ms | 284ms | Class::MOP::Class::get_all_attributes |
| 1134 | 1 | 1 | 117ms | 219ms | Class::MOP::Class::_single_metaclass_is_compatible |
| 284 | 2 | 1 | 92.7ms | 885ms | Class::MOP::Class::_check_metaclass_compatibility (recurses: max depth 1, inclusive time 3.85ms) |
| 205 | 1 | 1 | 37.0ms | 343ms | Class::MOP::Class::_can_fix_metaclass_incompatibility |
| 1203 | 7 | 2 | 35.4ms | 56.0ms | Class::MOP::Class::linearized_isa |
| 1134 | 1 | 1 | 30.1ms | 249ms | Class::MOP::Class::_check_single_metaclass_compatibility |
| 248 | 6 | 6 | 27.9ms | 237ms | Class::MOP::Class::find_method_by_name |
| 253 | 3 | 3 | 27.4ms | 189ms | Class::MOP::Class::find_next_method_by_name |
| 295 | 4 | 3 | 25.1ms | 119ms | Class::MOP::Class::class_precedence_list (recurses: max depth 4, inclusive time 93.2ms) |
| 178 | 3 | 3 | 21.7ms | 76.6ms | Class::MOP::Class::find_attribute_by_name |
| 174 | 1 | 1 | 21.3ms | 765ms | Class::MOP::Class::_construct_class_instance (recurses: max depth 1, inclusive time 990µs) |
| 330 | 5 | 5 | 16.3ms | 641ms | Class::MOP::Class::new_object |
| 116 | 3 | 1 | 14.3ms | 224ms | Class::MOP::Class::__ANON__[:967] |
| 162 | 1 | 1 | 13.3ms | 27.7ms | Class::MOP::Class::_class_metaclass_is_compatible |
| 184 | 1 | 1 | 12.6ms | 366ms | Class::MOP::Class::_fix_metaclass_incompatibility (recurses: max depth 1, inclusive time 2.59ms) |
| 787 | 11 | 5 | 12.2ms | 150ms | Class::MOP::Class::get_meta_instance |
| 187 | 1 | 1 | 11.9ms | 1.60s | Class::MOP::Class::_post_add_attribute |
| 81 | 2 | 2 | 11.4ms | 84.9ms | Class::MOP::Class::find_all_methods_by_name |
| 379 | 4 | 1 | 10.9ms | 17.6ms | Class::MOP::Class::_real_ref_name |
| 73 | 1 | 1 | 10.9ms | 712ms | Class::MOP::Class::_inline_constructor |
| 137 | 1 | 1 | 10.0ms | 138ms | Class::MOP::Class::_create_meta_instance |
| 93 | 1 | 1 | 9.74ms | 252ms | Class::MOP::Class::_immutable_metaclass (recurses: max depth 1, inclusive time 937µs) |
| 42 | 1 | 1 | 9.24ms | 611ms | Class::MOP::Class::reinitialize |
| 187 | 1 | 1 | 8.33ms | 1.56s | Class::MOP::Class::__ANON__[:790] |
| 110 | 1 | 1 | 8.08ms | 46.3ms | Class::MOP::Class::_superclasses_updated |
| 93 | 48 | 46 | 7.61ms | 1.39s | Class::MOP::Class::make_immutable (recurses: max depth 1, inclusive time 1.68ms) |
| 187 | 1 | 1 | 7.42ms | 9.66ms | Class::MOP::Class::invalidate_meta_instances |
| 205 | 1 | 1 | 7.28ms | 28.7ms | Class::MOP::Class::_class_metaclass_can_be_made_compatible |
| 93 | 2 | 2 | 7.14ms | 11.3ms | Class::MOP::Class::_immutable_options |
| 389 | 3 | 2 | 7.10ms | 7.10ms | Class::MOP::Class::_base_metaclasses |
| 42 | 1 | 1 | 6.82ms | 199ms | Class::MOP::Class::_inline_destructor |
| 93 | 1 | 1 | 5.70ms | 1.10s | Class::MOP::Class::_install_inlined_code |
| 1 | 1 | 1 | 5.34ms | 6.05ms | Class::MOP::Class::BEGIN@7 |
| 93 | 1 | 1 | 5.33ms | 1.11s | Class::MOP::Class::_initialize_immutable |
| 99 | 3 | 3 | 5.28ms | 218ms | Class::MOP::Class::add_around_method_modifier |
| 162 | 1 | 1 | 4.65ms | 32.4ms | Class::MOP::Class::_check_class_metaclass_compatibility |
| 187 | 1 | 1 | 4.44ms | 15.7ms | Class::MOP::Class::_attach_attribute |
| 1 | 1 | 1 | 4.29ms | 8.64ms | Class::MOP::Class::BEGIN@10 |
| 24 | 2 | 2 | 4.21ms | 343ms | Class::MOP::Class::create |
| 1 | 1 | 1 | 4.19ms | 5.04ms | Class::MOP::Class::BEGIN@8 |
| 1 | 1 | 1 | 4.03ms | 8.46ms | Class::MOP::Class::BEGIN@9 |
| 93 | 1 | 1 | 3.93ms | 256ms | Class::MOP::Class::_rebless_as_immutable (recurses: max depth 1, inclusive time 1.09ms) |
| 64 | 1 | 1 | 3.75ms | 3.75ms | Class::MOP::Class::_new |
| 32 | 1 | 1 | 3.15ms | 187ms | Class::MOP::Class::_inline_accessors |
| 73 | 2 | 2 | 2.88ms | 23.6ms | Class::MOP::Class::inline_create_instance |
| 317 | 1 | 1 | 2.51ms | 2.51ms | Class::MOP::Class::is_immutable |
| 42 | 1 | 1 | 2.35ms | 214ms | Class::MOP::Class::_restore_metaobjects_from |
| 112 | 2 | 1 | 2.26ms | 2.26ms | Class::MOP::Class::_add_inlined_method |
| 187 | 1 | 1 | 2.24ms | 2.24ms | Class::MOP::Class::invalidate_meta_instance |
| 42 | 1 | 1 | 2.04ms | 2.80ms | Class::MOP::Class::DESTROY |
| 1 | 1 | 1 | 2.00ms | 4.28ms | Class::MOP::Class::BEGIN@18 |
| 110 | 1 | 1 | 1.77ms | 1.77ms | Class::MOP::Class::_superclass_metas |
| 8 | 1 | 1 | 1.49ms | 27.4ms | Class::MOP::Class::get_all_methods |
| 42 | 1 | 1 | 1.46ms | 3.05ms | Class::MOP::Class::_remove_generated_metaobjects |
| 42 | 1 | 1 | 1.35ms | 1.81ms | Class::MOP::Class::is_anon_class |
| 110 | 1 | 1 | 1.28ms | 1.28ms | Class::MOP::Class::update_meta_instance_dependencies |
| 1 | 1 | 1 | 1.05ms | 1.40ms | Class::MOP::Class::BEGIN@11 |
| 22 | 1 | 1 | 1.05ms | 1.17s | Class::MOP::Class::create_anon_class |
| 1 | 1 | 1 | 1.04ms | 15.4ms | Class::MOP::Class::BEGIN@16 |
| 124 | 3 | 3 | 896µs | 896µs | Class::MOP::Class::is_mutable |
| 73 | 1 | 1 | 892µs | 892µs | Class::MOP::Class::reset_package_cache_flag |
| 11 | 1 | 1 | 610µs | 22.4ms | Class::MOP::Class::add_before_method_modifier |
| 1 | 1 | 1 | 371µs | 1.16ms | Class::MOP::Class::_clone_instance |
| 6 | 1 | 1 | 338µs | 6.72ms | Class::MOP::Class::add_after_method_modifier |
| 84 | 2 | 1 | 300µs | 300µs | Class::MOP::Class::CORE:match (opcode) |
| 1 | 1 | 1 | 111µs | 1.30ms | Class::MOP::Class::clone_object |
| 2 | 2 | 1 | 85µs | 85µs | Class::MOP::Class::CORE:regcomp (opcode) |
| 1 | 1 | 1 | 72µs | 91µs | Class::MOP::Class::BEGIN@4 |
| 1 | 1 | 1 | 55µs | 132µs | Class::MOP::Class::BEGIN@445 |
| 1 | 1 | 1 | 54µs | 259µs | Class::MOP::Class::BEGIN@17 |
| 1 | 1 | 1 | 51µs | 14.6ms | Class::MOP::Class::BEGIN@24 |
| 1 | 1 | 1 | 49µs | 119µs | Class::MOP::Class::BEGIN@480 |
| 1 | 1 | 1 | 40µs | 99µs | Class::MOP::Class::BEGIN@467 |
| 1 | 1 | 1 | 40µs | 201µs | Class::MOP::Class::BEGIN@13 |
| 1 | 1 | 1 | 39µs | 185µs | Class::MOP::Class::BEGIN@15 |
| 1 | 1 | 1 | 38µs | 221µs | Class::MOP::Class::BEGIN@14 |
| 1 | 1 | 1 | 37µs | 106µs | Class::MOP::Class::BEGIN@5 |
| 0 | 0 | 0 | 0s | 0s | Class::MOP::Class::__ANON__[:226] |
| 0 | 0 | 0 | 0s | 0s | Class::MOP::Class::__ANON__[:794] |
| 0 | 0 | 0 | 0s | 0s | Class::MOP::Class::_fix_class_metaclass_incompatibility |
| 0 | 0 | 0 | 0s | 0s | Class::MOP::Class::_fix_single_metaclass_incompatibility |
| 0 | 0 | 0 | 0s | 0s | Class::MOP::Class::_fixup_attributes_after_rebless |
| 0 | 0 | 0 | 0s | 0s | Class::MOP::Class::_force_rebless_instance |
| 0 | 0 | 0 | 0s | 0s | Class::MOP::Class::_inline_clear_mop_slot |
| 0 | 0 | 0 | 0s | 0s | Class::MOP::Class::_inline_get_mop_slot |
| 0 | 0 | 0 | 0s | 0s | Class::MOP::Class::_inline_set_mop_slot |
| 0 | 0 | 0 | 0s | 0s | Class::MOP::Class::_inlined_methods |
| 0 | 0 | 0 | 0s | 0s | Class::MOP::Class::_rebless_as_mutable |
| 0 | 0 | 0 | 0s | 0s | Class::MOP::Class::_remove_inlined_code |
| 0 | 0 | 0 | 0s | 0s | Class::MOP::Class::add_dependent_meta_instance |
| 0 | 0 | 0 | 0s | 0s | Class::MOP::Class::add_meta_instance_dependencies |
| 0 | 0 | 0 | 0s | 0s | Class::MOP::Class::direct_subclasses |
| 0 | 0 | 0 | 0s | 0s | Class::MOP::Class::get_all_method_names |
| 0 | 0 | 0 | 0s | 0s | Class::MOP::Class::immutable_options |
| 0 | 0 | 0 | 0s | 0s | Class::MOP::Class::inline_rebless_instance |
| 0 | 0 | 0 | 0s | 0s | Class::MOP::Class::is_pristine |
| 0 | 0 | 0 | 0s | 0s | Class::MOP::Class::make_mutable |
| 0 | 0 | 0 | 0s | 0s | Class::MOP::Class::rebless_instance |
| 0 | 0 | 0 | 0s | 0s | Class::MOP::Class::rebless_instance_away |
| 0 | 0 | 0 | 0s | 0s | Class::MOP::Class::rebless_instance_back |
| 0 | 0 | 0 | 0s | 0s | Class::MOP::Class::remove_attribute |
| 0 | 0 | 0 | 0s | 0s | Class::MOP::Class::remove_dependent_meta_instance |
| 0 | 0 | 0 | 0s | 0s | Class::MOP::Class::remove_meta_instance_dependencies |
| 0 | 0 | 0 | 0s | 0s | Class::MOP::Class::subclasses |
| 0 | 0 | 0 | 0s | 0s | Class::MOP::Class::update_package_cache_flag |
| Line | State ments |
Time on line |
Calls | Time in subs |
Code |
|---|---|---|---|---|---|
| 1 | |||||
| 2 | package Class::MOP::Class; | ||||
| 3 | |||||
| 4 | 3 | 97µs | 2 | 110µs | # spent 91µs (72+19) within Class::MOP::Class::BEGIN@4 which was called:
# once (72µs+19µs) by Class::MOP::BEGIN@19 at line 4 # spent 91µs making 1 call to Class::MOP::Class::BEGIN@4
# spent 19µs making 1 call to strict::import |
| 5 | 3 | 95µs | 2 | 175µs | # spent 106µs (37+69) within Class::MOP::Class::BEGIN@5 which was called:
# once (37µs+69µs) by Class::MOP::BEGIN@19 at line 5 # spent 106µs making 1 call to Class::MOP::Class::BEGIN@5
# spent 69µs making 1 call to warnings::import |
| 6 | |||||
| 7 | 3 | 436µs | 1 | 6.05ms | # spent 6.05ms (5.34+712µs) within Class::MOP::Class::BEGIN@7 which was called:
# once (5.34ms+712µs) by Class::MOP::BEGIN@19 at line 7 # spent 6.05ms making 1 call to Class::MOP::Class::BEGIN@7 |
| 8 | 3 | 459µs | 1 | 5.04ms | # spent 5.04ms (4.19+855µs) within Class::MOP::Class::BEGIN@8 which was called:
# once (4.19ms+855µs) by Class::MOP::BEGIN@19 at line 8 # spent 5.04ms making 1 call to Class::MOP::Class::BEGIN@8 |
| 9 | 3 | 486µs | 1 | 8.46ms | # spent 8.46ms (4.03+4.43) within Class::MOP::Class::BEGIN@9 which was called:
# once (4.03ms+4.43ms) by Class::MOP::BEGIN@19 at line 9 # spent 8.46ms making 1 call to Class::MOP::Class::BEGIN@9 |
| 10 | 3 | 485µs | 1 | 8.64ms | # spent 8.64ms (4.29+4.34) within Class::MOP::Class::BEGIN@10 which was called:
# once (4.29ms+4.34ms) by Class::MOP::BEGIN@19 at line 10 # spent 8.64ms making 1 call to Class::MOP::Class::BEGIN@10 |
| 11 | 3 | 599µs | 1 | 1.40ms | # spent 1.40ms (1.05+347µs) within Class::MOP::Class::BEGIN@11 which was called:
# once (1.05ms+347µs) by Class::MOP::BEGIN@19 at line 11 # spent 1.40ms making 1 call to Class::MOP::Class::BEGIN@11 |
| 12 | |||||
| 13 | 3 | 115µs | 2 | 362µs | # spent 201µs (40+161) within Class::MOP::Class::BEGIN@13 which was called:
# once (40µs+161µs) by Class::MOP::BEGIN@19 at line 13 # spent 201µs making 1 call to Class::MOP::Class::BEGIN@13
# spent 161µs making 1 call to Exporter::import |
| 14 | 3 | 177µs | 2 | 404µs | # spent 221µs (38+183) within Class::MOP::Class::BEGIN@14 which was called:
# once (38µs+183µs) by Class::MOP::BEGIN@19 at line 14 # spent 221µs making 1 call to Class::MOP::Class::BEGIN@14
# spent 183µs making 1 call to Exporter::import |
| 15 | 3 | 110µs | 2 | 331µs | # spent 185µs (39+146) within Class::MOP::Class::BEGIN@15 which was called:
# once (39µs+146µs) by Class::MOP::BEGIN@19 at line 15 # spent 185µs making 1 call to Class::MOP::Class::BEGIN@15
# spent 146µs making 1 call to Exporter::import |
| 16 | 3 | 475µs | 2 | 16.2ms | # spent 15.4ms (1.04+14.3) within Class::MOP::Class::BEGIN@16 which was called:
# once (1.04ms+14.3ms) by Class::MOP::BEGIN@19 at line 16 # spent 15.4ms making 1 call to Class::MOP::Class::BEGIN@16
# spent 854µs making 1 call to Sub::Exporter::__ANON__[Sub/Exporter.pm:756] |
| 17 | 3 | 113µs | 2 | 464µs | # spent 259µs (54+205) within Class::MOP::Class::BEGIN@17 which was called:
# once (54µs+205µs) by Class::MOP::BEGIN@19 at line 17 # spent 259µs making 1 call to Class::MOP::Class::BEGIN@17
# spent 205µs making 1 call to Exporter::import |
| 18 | 3 | 656µs | 2 | 4.85ms | # spent 4.28ms (2.00+2.27) within Class::MOP::Class::BEGIN@18 which was called:
# once (2.00ms+2.27ms) by Class::MOP::BEGIN@19 at line 18 # spent 4.28ms making 1 call to Class::MOP::Class::BEGIN@18
# spent 570µs making 1 call to Exporter::import |
| 19 | |||||
| 20 | 1 | 5µs | our $VERSION = '1.11'; | ||
| 21 | 1 | 93µs | $VERSION = eval $VERSION; # spent 13µs executing statements in string eval | ||
| 22 | 1 | 4µs | our $AUTHORITY = 'cpan:STEVAN'; | ||
| 23 | |||||
| 24 | 1 | 0s | # spent 14.6ms (51µs+14.5) within Class::MOP::Class::BEGIN@24 which was called:
# once (51µs+14.5ms) by Class::MOP::BEGIN@19 at line 26 # spent 14.5ms making 1 call to base::import, recursion: max depth 1, sum of overlapping time 14.5ms | ||
| 25 | 'Class::MOP::Mixin::HasAttributes', | ||||
| 26 | 3 | 6.06ms | 1 | 14.6ms | 'Class::MOP::Mixin::HasMethods'; # spent 14.6ms making 1 call to Class::MOP::Class::BEGIN@24 |
| 27 | |||||
| 28 | # Creation | ||||
| 29 | |||||
| 30 | # spent 1.03s (213ms+817ms) within Class::MOP::Class::initialize which was called 6454 times, avg 160µs/call:
# 2686 times (83.5ms+22.6ms) by Class::MOP::Class::get_all_attributes at line 826, avg 39µs/call
# 757 times (27.0ms+22.2ms) by Class::MOP::Class::__ANON__::SERIAL::11::meta or Class::MOP::Class::__ANON__::SERIAL::15::meta or Class::MOP::Class::__ANON__::SERIAL::19::meta or Class::MOP::Class::__ANON__::SERIAL::1::meta or Class::MOP::Class::__ANON__::SERIAL::5::meta or Class::MOP::Class::__ANON__::SERIAL::8::meta or Class::MOP::Mixin::meta or Class::MOP::Object::meta or Markdent::Dialect::Standard::BlockParser::meta or Markdent::Dialect::Standard::SpanParser::meta or Markdent::Event::AutoLink::meta or Markdent::Event::EndBlockquote::meta or Markdent::Event::EndCode::meta or Markdent::Event::EndDocument::meta or Markdent::Event::EndEmphasis::meta or Markdent::Event::EndHTMLTag::meta or Markdent::Event::EndHeader::meta or Markdent::Event::EndLink::meta or Markdent::Event::EndListItem::meta or Markdent::Event::EndOrderedList::meta or Markdent::Event::EndParagraph::meta or Markdent::Event::EndStrong::meta or Markdent::Event::EndUnorderedList::meta or Markdent::Event::HTMLBlock::meta or Markdent::Event::HTMLComment::meta or Markdent::Event::HTMLCommentBlock::meta or Markdent::Event::HTMLEntity::meta or Markdent::Event::HTMLTag::meta or Markdent::Event::HorizontalRule::meta or Markdent::Event::Image::meta or Markdent::Event::Preformatted::meta or Markdent::Event::StartBlockquote::meta or Markdent::Event::StartCode::meta or Markdent::Event::StartDocument::meta or Markdent::Event::StartEmphasis::meta or Markdent::Event::StartHTMLTag::meta or Markdent::Event::StartHeader::meta or Markdent::Event::StartLink::meta or Markdent::Event::StartListItem::meta or Markdent::Event::StartOrderedList::meta or Markdent::Event::StartParagraph::meta or Markdent::Event::StartStrong::meta or Markdent::Event::StartUnorderedList::meta or Markdent::Event::Text::meta or Markdent::Handler::HTMLStream::Document::meta or Markdent::Parser::meta or Moose::Meta::Role::Application::RoleSummation::meta or Moose::Meta::Role::Application::ToClass::meta or Moose::Meta::Role::Application::ToInstance::meta or Moose::Meta::Role::Application::ToRole::meta or Moose::Meta::Role::Application::meta or Moose::Meta::Role::Composite::meta or Moose::Meta::Role::Method::Required::meta or Moose::Meta::Role::meta or Moose::Meta::TypeCoercion::Union::meta or Moose::Meta::TypeCoercion::meta or Moose::Meta::TypeConstraint::Class::meta or Moose::Meta::TypeConstraint::DuckType::meta or Moose::Meta::TypeConstraint::Enum::meta or Moose::Meta::TypeConstraint::Parameterizable::meta or Moose::Meta::TypeConstraint::Parameterized::meta or Moose::Meta::TypeConstraint::Registry::meta or Moose::Meta::TypeConstraint::Role::meta or Moose::Meta::TypeConstraint::Union::meta or Moose::Meta::TypeConstraint::meta or MooseX::Role::Parameterized::Meta::Parameter::meta or MooseX::Role::Parameterized::Meta::Role::Parameterizable::meta or MooseX::Role::Parameterized::Meta::Role::Parameterized::meta or MooseX::Role::Parameterized::Parameters::meta at line 44 of Class/MOP/Method/Meta.pm, avg 65µs/call
# 611 times (21.1ms+5.95ms) by Class::MOP::Class::find_method_by_name at line 1018, avg 44µs/call
# 498 times (15.2ms+4.40ms) by Class::MOP::Class::find_attribute_by_name at line 816, avg 39µs/call
# 474 times (15.8ms+4.81ms) by Class::MOP::Class::find_next_method_by_name at line 1067, avg 43µs/call
# 260 times (8.20ms+2.52ms) by Moose::Meta::Attribute::_new or Moose::Meta::Method::_new or Moose::Meta::Role::_new at line 4 of (eval 76)[Class/MOP/Method/Generated.pm:53], avg 41µs/call
# 253 times (8.22ms+2.29ms) by Class::MOP::Class::find_all_methods_by_name at line 1050, avg 42µs/call
# 232 times (7.61ms+2.32ms) by Class::MOP::Class::class_precedence_list at line 927, avg 43µs/call
# 205 times (7.03ms+1.82ms) by Class::MOP::Class::_fix_metaclass_incompatibility at line 310, avg 43µs/call
# 110 times (5.69ms+674ms) by Moose::Meta::Class::initialize at line 68 of Moose/Meta/Class.pm, avg 6.18ms/call
# 98 times (3.42ms+1.02ms) by Class::MOP::Attribute::set_initial_value at line 253 of Class/MOP/Attribute.pm, avg 45µs/call
# 80 times (2.75ms+886µs) by Moose::Util::MetaRole::_make_new_class at line 157 of Moose/Util/MetaRole.pm, avg 45µs/call
# 49 times (2.26ms+599µs) by namespace::autoclean::__ANON__[/home/doy/perl5/perlbrew/perls/perl-5.10.1/lib/site_perl/5.10.1/namespace/autoclean.pm:57] at line 44 of namespace/autoclean.pm, avg 58µs/call
# 33 times (1.28ms+25.1ms) by Class::MOP::Object::meta at line 18 of Class/MOP/Object.pm, avg 799µs/call
# 26 times (811µs+8.49ms) by Class::MOP::Method::_new at line 54 of Class/MOP/Method.pm, avg 358µs/call
# 19 times (1.02ms+11.2ms) by metaclass::import at line 45 of metaclass.pm, avg 643µs/call
# 18 times (679µs+7.02ms) by Class::MOP::Mixin::meta at line 14 of Class/MOP/Mixin.pm, avg 428µs/call
# 14 times (680µs+14.7ms) by Class::MOP::MiniTrait::apply at line 15 of Class/MOP/MiniTrait.pm, avg 1.10ms/call
# 9 times (280µs+74µs) by Class::MOP::Class::get_all_methods at line 1029, avg 39µs/call
# 8 times (235µs+71µs) by Class::MOP::Attribute::get_raw_value at line 274 of Class/MOP/Attribute.pm, avg 38µs/call
# 7 times (340µs+3.80ms) by Moose::BEGIN@38 at line 11 of Moose/Meta/Attribute/Native.pm, avg 591µs/call
# 2 times (89µs+1.16ms) by Class::MOP::Class::create at line 525, avg 626µs/call
# 2 times (88µs+28µs) by Class::MOP::Attribute::has_value at line 282 of Class/MOP/Attribute.pm, avg 58µs/call
# 2 times (59µs+17µs) by Class::MOP::Attribute::set_raw_value at line 266 of Class/MOP/Attribute.pm, avg 38µs/call
# once (31µs+9µs) by Class::MOP::Attribute::_new at line 62 of Class/MOP/Attribute.pm | ||||
| 31 | 32270 | 205ms | my $class = shift; | ||
| 32 | |||||
| 33 | my $package_name; | ||||
| 34 | |||||
| 35 | if ( @_ % 2 ) { | ||||
| 36 | $package_name = shift; | ||||
| 37 | } else { | ||||
| 38 | my %options = @_; | ||||
| 39 | $package_name = $options{package}; | ||||
| 40 | } | ||||
| 41 | |||||
| 42 | ($package_name && !ref($package_name)) | ||||
| 43 | || confess "You must pass a package name and it cannot be blessed"; | ||||
| 44 | |||||
| 45 | 6628 | 826ms | return Class::MOP::get_metaclass_by_name($package_name) # spent 766ms making 174 calls to Class::MOP::Class::_construct_class_instance, avg 4.40ms/call, recursion: max depth 1, sum of overlapping time 990µs
# spent 60.5ms making 6454 calls to Class::MOP::get_metaclass_by_name, avg 9µs/call | ||
| 46 | || $class->_construct_class_instance(package => $package_name, @_); | ||||
| 47 | } | ||||
| 48 | |||||
| 49 | # spent 611ms (9.24+601) within Class::MOP::Class::reinitialize which was called 42 times, avg 14.5ms/call:
# 42 times (9.24ms+601ms) by Moose::Meta::Class::reinitialize at line 157 of Moose/Meta/Class.pm, avg 14.5ms/call | ||||
| 50 | 378 | 10.7ms | my ( $class, @args ) = @_; | ||
| 51 | unshift @args, "package" if @args % 2; | ||||
| 52 | my %options = @args; | ||||
| 53 | 42 | 301µs | my $old_metaclass = blessed($options{package}) # spent 301µs making 42 calls to Scalar::Util::blessed, avg 7µs/call | ||
| 54 | ? $options{package} | ||||
| 55 | : Class::MOP::get_metaclass_by_name($options{package}); | ||||
| 56 | 168 | 1.81ms | $options{weaken} = Class::MOP::metaclass_is_weak($old_metaclass->name) # spent 1.08ms making 42 calls to Class::MOP::metaclass_is_weak, avg 26µs/call
# spent 290µs making 42 calls to UNIVERSAL::isa, avg 7µs/call
# spent 238µs making 42 calls to Scalar::Util::blessed, avg 6µs/call
# spent 205µs making 42 calls to Class::MOP::Package::name, avg 5µs/call | ||
| 57 | if !exists $options{weaken} | ||||
| 58 | && blessed($old_metaclass) | ||||
| 59 | && $old_metaclass->isa('Class::MOP::Class'); | ||||
| 60 | 84 | 3.30ms | $old_metaclass->_remove_generated_metaobjects # spent 3.05ms making 42 calls to Class::MOP::Class::_remove_generated_metaobjects, avg 73µs/call
# spent 254µs making 42 calls to UNIVERSAL::isa, avg 6µs/call | ||
| 61 | if $old_metaclass && $old_metaclass->isa('Class::MOP::Class'); | ||||
| 62 | 42 | 381ms | my $new_metaclass = $class->SUPER::reinitialize(%options); # spent 381ms making 42 calls to Class::MOP::Package::reinitialize, avg 9.08ms/call | ||
| 63 | 84 | 215ms | $new_metaclass->_restore_metaobjects_from($old_metaclass) # spent 214ms making 42 calls to Class::MOP::Class::_restore_metaobjects_from, avg 5.11ms/call
# spent 299µs making 42 calls to UNIVERSAL::isa, avg 7µs/call | ||
| 64 | if $old_metaclass && $old_metaclass->isa('Class::MOP::Class'); | ||||
| 65 | return $new_metaclass; | ||||
| 66 | } | ||||
| 67 | |||||
| 68 | # NOTE: (meta-circularity) | ||||
| 69 | # this is a special form of _construct_instance | ||||
| 70 | # (see below), which is used to construct class | ||||
| 71 | # meta-object instances for any Class::MOP::* | ||||
| 72 | # class. All other classes will use the more | ||||
| 73 | # normal &construct_instance. | ||||
| 74 | # spent 765ms (21.3+744) within Class::MOP::Class::_construct_class_instance which was called 174 times, avg 4.40ms/call:
# 174 times (21.3ms+744ms) by Class::MOP::Class::initialize at line 45, avg 4.40ms/call | ||||
| 75 | 2088 | 16.5ms | my $class = shift; | ||
| 76 | my $options = @_ == 1 ? $_[0] : {@_}; | ||||
| 77 | my $package_name = $options->{package}; | ||||
| 78 | (defined $package_name && $package_name) | ||||
| 79 | || confess "You must pass a package name"; | ||||
| 80 | # NOTE: | ||||
| 81 | # return the metaclass if we have it cached, | ||||
| 82 | # and it is still defined (it has not been | ||||
| 83 | # reaped by DESTROY yet, which can happen | ||||
| 84 | # annoyingly enough during global destruction) | ||||
| 85 | |||||
| 86 | 174 | 1.42ms | if (defined(my $meta = Class::MOP::get_metaclass_by_name($package_name))) { # spent 1.42ms making 174 calls to Class::MOP::get_metaclass_by_name, avg 8µs/call | ||
| 87 | return $meta; | ||||
| 88 | } | ||||
| 89 | |||||
| 90 | $class | ||||
| 91 | 10 | 1.06ms | = ref $class # spent 1.06ms making 10 calls to Class::MOP::Class::_real_ref_name, avg 106µs/call | ||
| 92 | ? $class->_real_ref_name | ||||
| 93 | : $class; | ||||
| 94 | |||||
| 95 | # now create the metaclass | ||||
| 96 | my $meta; | ||||
| 97 | 110 | 2.73ms | 64 | 3.75ms | if ($class eq 'Class::MOP::Class') { # spent 3.75ms making 64 calls to Class::MOP::Class::_new, avg 59µs/call |
| 98 | $meta = $class->_new($options); | ||||
| 99 | } | ||||
| 100 | else { | ||||
| 101 | # NOTE: | ||||
| 102 | # it is safe to use meta here because | ||||
| 103 | # class will always be a subclass of | ||||
| 104 | # Class::MOP::Class, which defines meta | ||||
| 105 | 220 | 399ms | $meta = $class->meta->_construct_instance($options) # spent 389ms making 110 calls to Class::MOP::Class::_construct_instance, avg 3.54ms/call
# spent 9.09ms making 110 calls to Class::MOP::Object::meta, avg 83µs/call | ||
| 106 | } | ||||
| 107 | |||||
| 108 | # and check the metaclass compatibility | ||||
| 109 | 174 | 334ms | $meta->_check_metaclass_compatibility(); # spent 338ms making 174 calls to Class::MOP::Class::_check_metaclass_compatibility, avg 1.94ms/call, recursion: max depth 1, sum of overlapping time 3.85ms | ||
| 110 | |||||
| 111 | 174 | 2.36ms | Class::MOP::store_metaclass_by_name($package_name, $meta); # spent 2.36ms making 174 calls to Class::MOP::store_metaclass_by_name, avg 14µs/call | ||
| 112 | |||||
| 113 | # NOTE: | ||||
| 114 | # we need to weaken any anon classes | ||||
| 115 | # so that they can call DESTROY properly | ||||
| 116 | 2 | 61µs | Class::MOP::weaken_metaclass($package_name) if $options->{weaken}; # spent 61µs making 2 calls to Class::MOP::weaken_metaclass, avg 30µs/call | ||
| 117 | |||||
| 118 | $meta; | ||||
| 119 | } | ||||
| 120 | |||||
| 121 | # spent 17.6ms (10.9+6.72) within Class::MOP::Class::_real_ref_name which was called 379 times, avg 47µs/call:
# 205 times (5.70ms+3.61ms) by Class::MOP::Class::_class_metaclass_can_be_made_compatible at line 355, avg 45µs/call
# 162 times (4.78ms+2.36ms) by Class::MOP::Class::_class_metaclass_is_compatible at line 265, avg 44µs/call
# 10 times (376µs+688µs) by Class::MOP::Class::_construct_class_instance at line 91, avg 106µs/call
# 2 times (64µs+65µs) by Class::MOP::Class::_immutable_metaclass at line 1244, avg 64µs/call | ||||
| 122 | 758 | 10.2ms | my $self = shift; | ||
| 123 | |||||
| 124 | # NOTE: we need to deal with the possibility of class immutability here, | ||||
| 125 | # and then get the name of the class appropriately | ||||
| 126 | 441 | 6.72ms | return $self->is_immutable # spent 2.87ms making 56 calls to Class::MOP::Class::Immutable::Class::MOP::Class::is_immutable, avg 51µs/call
# spent 2.51ms making 317 calls to Class::MOP::Class::is_immutable, avg 8µs/call
# spent 953µs making 62 calls to Class::MOP::Class::Immutable::Trait::_get_mutable_metaclass_name, avg 15µs/call
# spent 384µs making 6 calls to Class::MOP::Class::Immutable::Moose::Meta::Class::is_immutable, avg 64µs/call | ||
| 127 | ? $self->_get_mutable_metaclass_name() | ||||
| 128 | : ref $self; | ||||
| 129 | } | ||||
| 130 | |||||
| 131 | # spent 3.75ms within Class::MOP::Class::_new which was called 64 times, avg 59µs/call:
# 64 times (3.75ms+0s) by Class::MOP::Class::_construct_class_instance at line 97, avg 59µs/call | ||||
| 132 | 256 | 4.04ms | my $class = shift; | ||
| 133 | |||||
| 134 | return Class::MOP::Class->initialize($class)->new_object(@_) | ||||
| 135 | if $class ne __PACKAGE__; | ||||
| 136 | |||||
| 137 | my $options = @_ == 1 ? $_[0] : {@_}; | ||||
| 138 | |||||
| 139 | return bless { | ||||
| 140 | # inherited from Class::MOP::Package | ||||
| 141 | 'package' => $options->{package}, | ||||
| 142 | |||||
| 143 | # NOTE: | ||||
| 144 | # since the following attributes will | ||||
| 145 | # actually be loaded from the symbol | ||||
| 146 | # table, and actually bypass the instance | ||||
| 147 | # entirely, we can just leave these things | ||||
| 148 | # listed here for reference, because they | ||||
| 149 | # should not actually have a value associated | ||||
| 150 | # with the slot. | ||||
| 151 | 'namespace' => \undef, | ||||
| 152 | 'methods' => {}, | ||||
| 153 | |||||
| 154 | # inherited from Class::MOP::Module | ||||
| 155 | 'version' => \undef, | ||||
| 156 | 'authority' => \undef, | ||||
| 157 | |||||
| 158 | # defined in Class::MOP::Class | ||||
| 159 | 'superclasses' => \undef, | ||||
| 160 | |||||
| 161 | 'attributes' => {}, | ||||
| 162 | 'attribute_metaclass' => | ||||
| 163 | ( $options->{'attribute_metaclass'} || 'Class::MOP::Attribute' ), | ||||
| 164 | 'method_metaclass' => | ||||
| 165 | ( $options->{'method_metaclass'} || 'Class::MOP::Method' ), | ||||
| 166 | 'wrapped_method_metaclass' => ( | ||||
| 167 | $options->{'wrapped_method_metaclass'} | ||||
| 168 | || 'Class::MOP::Method::Wrapped' | ||||
| 169 | ), | ||||
| 170 | 'instance_metaclass' => | ||||
| 171 | ( $options->{'instance_metaclass'} || 'Class::MOP::Instance' ), | ||||
| 172 | 'immutable_trait' => ( | ||||
| 173 | $options->{'immutable_trait'} | ||||
| 174 | || 'Class::MOP::Class::Immutable::Trait' | ||||
| 175 | ), | ||||
| 176 | 'constructor_name' => ( $options->{constructor_name} || 'new' ), | ||||
| 177 | 'constructor_class' => ( | ||||
| 178 | $options->{constructor_class} || 'Class::MOP::Method::Constructor' | ||||
| 179 | ), | ||||
| 180 | 'destructor_class' => $options->{destructor_class}, | ||||
| 181 | }, $class; | ||||
| 182 | } | ||||
| 183 | |||||
| 184 | 73 | 1.08ms | # spent 892µs within Class::MOP::Class::reset_package_cache_flag which was called 73 times, avg 12µs/call:
# 73 times (892µs+0s) by Moose::Meta::Role::Application::ToClass::apply_methods at line 190 of Moose/Meta/Role/Application/ToClass.pm, avg 12µs/call | ||
| 185 | sub update_package_cache_flag { | ||||
| 186 | my $self = shift; | ||||
| 187 | # NOTE: | ||||
| 188 | # we can manually update the cache number | ||||
| 189 | # since we are actually adding the method | ||||
| 190 | # to our cache as well. This avoids us | ||||
| 191 | # having to regenerate the method_map. | ||||
| 192 | # - SL | ||||
| 193 | $self->{'_package_cache_flag'} = Class::MOP::check_package_cache_flag($self->name); | ||||
| 194 | } | ||||
| 195 | |||||
| 196 | ## Metaclass compatibility | ||||
| 197 | { | ||||
| 198 | 2 | 22µs | my %base_metaclass = ( | ||
| 199 | attribute_metaclass => 'Class::MOP::Attribute', | ||||
| 200 | method_metaclass => 'Class::MOP::Method', | ||||
| 201 | wrapped_method_metaclass => 'Class::MOP::Method::Wrapped', | ||||
| 202 | instance_metaclass => 'Class::MOP::Instance', | ||||
| 203 | constructor_class => 'Class::MOP::Method::Constructor', | ||||
| 204 | destructor_class => 'Class::MOP::Method::Destructor', | ||||
| 205 | ); | ||||
| 206 | |||||
| 207 | 389 | 8.83ms | # spent 7.10ms within Class::MOP::Class::_base_metaclasses which was called 389 times, avg 18µs/call:
# 312 times (5.82ms+0s) by Moose::Meta::Class::_base_metaclasses at line 354 of Moose/Meta/Class.pm, avg 19µs/call
# 43 times (765µs+0s) by Class::MOP::Class::_can_fix_metaclass_incompatibility at line 343, avg 18µs/call
# 34 times (507µs+0s) by Class::MOP::Class::_check_metaclass_compatibility at line 218, avg 15µs/call | ||
| 208 | } | ||||
| 209 | |||||
| 210 | # spent 885ms (92.7+792) within Class::MOP::Class::_check_metaclass_compatibility which was called 284 times, avg 3.11ms/call:
# 174 times (23.4ms+310ms) by Class::MOP::Class::_construct_class_instance at line 109, avg 1.92ms/call
# 110 times (69.3ms+481ms) by Class::MOP::Class::superclasses at line 857, avg 5.01ms/call | ||||
| 211 | 1420 | 19.6ms | my $self = shift; | ||
| 212 | |||||
| 213 | 284 | 64.9ms | my @superclasses = $self->superclasses # spent 72.8ms making 218 calls to Moose::Meta::Class::superclasses, avg 334µs/call, recursion: max depth 1, sum of overlapping time 26.5ms
# spent 19.2ms making 66 calls to Class::MOP::Class::superclasses, avg 291µs/call, recursion: max depth 1, sum of overlapping time 560µs | ||
| 214 | or return; | ||||
| 215 | |||||
| 216 | 184 | 366ms | $self->_fix_metaclass_incompatibility(@superclasses); # spent 369ms making 184 calls to Class::MOP::Class::_fix_metaclass_incompatibility, avg 2.00ms/call, recursion: max depth 1, sum of overlapping time 2.59ms | ||
| 217 | |||||
| 218 | 184 | 34.0ms | my %base_metaclass = $self->_base_metaclasses; # spent 33.5ms making 150 calls to Moose::Meta::Class::_base_metaclasses, avg 224µs/call
# spent 507µs making 34 calls to Class::MOP::Class::_base_metaclasses, avg 15µs/call | ||
| 219 | |||||
| 220 | # this is always okay ... | ||||
| 221 | return | ||||
| 222 | if ref($self) eq 'Class::MOP::Class' | ||||
| 223 | && all { | ||||
| 224 | 408 | 2.92ms | 204 | 1.93ms | my $meta = $self->$_; # spent 366µs making 34 calls to Class::MOP::Mixin::HasMethods::wrapped_method_metaclass, avg 11µs/call
# spent 329µs making 34 calls to Class::MOP::Mixin::HasMethods::method_metaclass, avg 10µs/call
# spent 325µs making 34 calls to Class::MOP::Mixin::HasAttributes::attribute_metaclass, avg 10µs/call
# spent 318µs making 34 calls to Class::MOP::Class::constructor_class, avg 9µs/call
# spent 310µs making 34 calls to Class::MOP::Class::instance_metaclass, avg 9µs/call
# spent 281µs making 34 calls to Class::MOP::Class::destructor_class, avg 8µs/call |
| 225 | 1 | 1.21ms | !defined($meta) || $meta eq $base_metaclass{$_}; | ||
| 226 | } | ||||
| 227 | 34 | 6.35ms | keys %base_metaclass; # spent 6.35ms making 34 calls to List::MoreUtils::all, avg 187µs/call | ||
| 228 | |||||
| 229 | for my $superclass (@superclasses) { | ||||
| 230 | 162 | 2.81ms | 162 | 32.4ms | $self->_check_class_metaclass_compatibility($superclass); # spent 32.4ms making 162 calls to Class::MOP::Class::_check_class_metaclass_compatibility, avg 200µs/call |
| 231 | } | ||||
| 232 | |||||
| 233 | for my $metaclass_type ( keys %base_metaclass ) { | ||||
| 234 | 2100 | 21.7ms | 1050 | 13.5ms | next unless defined $self->$metaclass_type; # spent 2.20ms making 150 calls to Moose::Meta::Class::error_class, avg 15µs/call
# spent 2.07ms making 150 calls to Moose::Meta::Class::constructor_class, avg 14µs/call
# spent 2.04ms making 150 calls to Moose::Meta::Class::destructor_class, avg 14µs/call
# spent 1.86ms making 150 calls to Class::MOP::Mixin::HasMethods::wrapped_method_metaclass, avg 12µs/call
# spent 1.84ms making 150 calls to Class::MOP::Mixin::HasMethods::method_metaclass, avg 12µs/call
# spent 1.77ms making 150 calls to Class::MOP::Class::instance_metaclass, avg 12µs/call
# spent 1.76ms making 150 calls to Class::MOP::Mixin::HasAttributes::attribute_metaclass, avg 12µs/call |
| 235 | for my $superclass (@superclasses) { | ||||
| 236 | 1134 | 40.9ms | 1134 | 249ms | $self->_check_single_metaclass_compatibility( $metaclass_type, # spent 249ms making 1134 calls to Class::MOP::Class::_check_single_metaclass_compatibility, avg 219µs/call |
| 237 | $superclass ); | ||||
| 238 | } | ||||
| 239 | } | ||||
| 240 | } | ||||
| 241 | |||||
| 242 | # spent 32.4ms (4.65+27.7) within Class::MOP::Class::_check_class_metaclass_compatibility which was called 162 times, avg 200µs/call:
# 162 times (4.65ms+27.7ms) by Class::MOP::Class::_check_metaclass_compatibility at line 230, avg 200µs/call | ||||
| 243 | 486 | 4.25ms | my $self = shift; | ||
| 244 | my ( $superclass_name ) = @_; | ||||
| 245 | |||||
| 246 | 162 | 27.7ms | if (!$self->_class_metaclass_is_compatible($superclass_name)) { # spent 27.7ms making 162 calls to Class::MOP::Class::_class_metaclass_is_compatible, avg 171µs/call | ||
| 247 | my $super_meta = Class::MOP::get_metaclass_by_name($superclass_name); | ||||
| 248 | |||||
| 249 | my $super_meta_type = $super_meta->_real_ref_name; | ||||
| 250 | |||||
| 251 | confess "The metaclass of " . $self->name . " (" | ||||
| 252 | . (ref($self)) . ")" . " is not compatible with " | ||||
| 253 | . "the metaclass of its superclass, " | ||||
| 254 | . $superclass_name . " (" . ($super_meta_type) . ")"; | ||||
| 255 | } | ||||
| 256 | } | ||||
| 257 | |||||
| 258 | # spent 27.7ms (13.3+14.4) within Class::MOP::Class::_class_metaclass_is_compatible which was called 162 times, avg 171µs/call:
# 162 times (13.3ms+14.4ms) by Class::MOP::Class::_check_class_metaclass_compatibility at line 246, avg 171µs/call | ||||
| 259 | 810 | 8.17ms | my $self = shift; | ||
| 260 | my ( $superclass_name ) = @_; | ||||
| 261 | |||||
| 262 | 162 | 1.73ms | my $super_meta = Class::MOP::get_metaclass_by_name($superclass_name) # spent 1.73ms making 162 calls to Class::MOP::get_metaclass_by_name, avg 11µs/call | ||
| 263 | || return 1; | ||||
| 264 | |||||
| 265 | 162 | 7.14ms | my $super_meta_name = $super_meta->_real_ref_name; # spent 7.14ms making 162 calls to Class::MOP::Class::_real_ref_name, avg 44µs/call | ||
| 266 | |||||
| 267 | 162 | 5.54ms | return $self->_is_compatible_with($super_meta_name); # spent 5.54ms making 162 calls to Class::MOP::Object::_is_compatible_with, avg 34µs/call | ||
| 268 | } | ||||
| 269 | |||||
| 270 | # spent 249ms (30.1+219) within Class::MOP::Class::_check_single_metaclass_compatibility which was called 1134 times, avg 219µs/call:
# 1134 times (30.1ms+219ms) by Class::MOP::Class::_check_metaclass_compatibility at line 236, avg 219µs/call | ||||
| 271 | 3402 | 28.6ms | my $self = shift; | ||
| 272 | my ( $metaclass_type, $superclass_name ) = @_; | ||||
| 273 | |||||
| 274 | 1134 | 219ms | if (!$self->_single_metaclass_is_compatible($metaclass_type, $superclass_name)) { # spent 219ms making 1134 calls to Class::MOP::Class::_single_metaclass_is_compatible, avg 193µs/call | ||
| 275 | my $super_meta = Class::MOP::get_metaclass_by_name($superclass_name); | ||||
| 276 | my $metaclass_type_name = $metaclass_type; | ||||
| 277 | $metaclass_type_name =~ s/_(?:meta)?class$//; | ||||
| 278 | $metaclass_type_name =~ s/_/ /g; | ||||
| 279 | confess "The $metaclass_type_name metaclass for " | ||||
| 280 | . $self->name . " (" . ($self->$metaclass_type) | ||||
| 281 | . ")" . " is not compatible with the " | ||||
| 282 | . "$metaclass_type_name metaclass of its " | ||||
| 283 | . "superclass, $superclass_name (" | ||||
| 284 | . ($super_meta->$metaclass_type) . ")"; | ||||
| 285 | } | ||||
| 286 | } | ||||
| 287 | |||||
| 288 | # spent 219ms (117+102) within Class::MOP::Class::_single_metaclass_is_compatible which was called 1134 times, avg 193µs/call:
# 1134 times (117ms+102ms) by Class::MOP::Class::_check_single_metaclass_compatibility at line 274, avg 193µs/call | ||||
| 289 | 7793 | 105ms | my $self = shift; | ||
| 290 | my ( $metaclass_type, $superclass_name ) = @_; | ||||
| 291 | |||||
| 292 | 1134 | 9.51ms | my $super_meta = Class::MOP::get_metaclass_by_name($superclass_name) # spent 9.51ms making 1134 calls to Class::MOP::get_metaclass_by_name, avg 8µs/call | ||
| 293 | || return 1; | ||||
| 294 | |||||
| 295 | # for instance, Moose::Meta::Class has a error_class attribute, but | ||||
| 296 | # Class::MOP::Class doesn't - this shouldn't be an error | ||||
| 297 | 1134 | 7.28ms | return 1 unless $super_meta->can($metaclass_type); # spent 7.28ms making 1134 calls to UNIVERSAL::can, avg 6µs/call | ||
| 298 | # for instance, Moose::Meta::Class has a destructor_class, but | ||||
| 299 | # Class::MOP::Class doesn't - this shouldn't be an error | ||||
| 300 | 1105 | 12.3ms | return 1 unless defined $super_meta->$metaclass_type; # spent 1.72ms making 162 calls to Class::MOP::Mixin::HasMethods::method_metaclass, avg 11µs/call
# spent 1.70ms making 162 calls to Class::MOP::Mixin::HasAttributes::attribute_metaclass, avg 11µs/call
# spent 1.69ms making 133 calls to Moose::Meta::Class::constructor_class, avg 13µs/call
# spent 1.67ms making 162 calls to Class::MOP::Mixin::HasMethods::wrapped_method_metaclass, avg 10µs/call
# spent 1.67ms making 133 calls to Moose::Meta::Class::destructor_class, avg 13µs/call
# spent 1.65ms making 133 calls to Moose::Meta::Class::error_class, avg 12µs/call
# spent 1.64ms making 162 calls to Class::MOP::Class::instance_metaclass, avg 10µs/call
# spent 285µs making 29 calls to Class::MOP::Class::constructor_class, avg 10µs/call
# spent 261µs making 29 calls to Class::MOP::Class::destructor_class, avg 9µs/call | ||
| 301 | # if metaclass is defined in superclass but not here, it's not compatible | ||||
| 302 | # this is a really odd case | ||||
| 303 | 1076 | 11.6ms | return 0 unless defined $self->$metaclass_type; # spent 1.99ms making 162 calls to Moose::Meta::Class::constructor_class, avg 12µs/call
# spent 1.65ms making 162 calls to Class::MOP::Mixin::HasMethods::wrapped_method_metaclass, avg 10µs/call
# spent 1.64ms making 133 calls to Moose::Meta::Class::error_class, avg 12µs/call
# spent 1.63ms making 133 calls to Moose::Meta::Class::destructor_class, avg 12µs/call
# spent 1.59ms making 162 calls to Class::MOP::Mixin::HasMethods::method_metaclass, avg 10µs/call
# spent 1.58ms making 162 calls to Class::MOP::Mixin::HasAttributes::attribute_metaclass, avg 10µs/call
# spent 1.51ms making 162 calls to Class::MOP::Class::instance_metaclass, avg 9µs/call | ||
| 304 | |||||
| 305 | 3228 | 61.3ms | return $self->$metaclass_type->_is_compatible_with($super_meta->$metaclass_type); # spent 38.9ms making 1076 calls to Class::MOP::Object::_is_compatible_with, avg 36µs/call
# spent 3.49ms making 295 calls to Moose::Meta::Class::constructor_class, avg 12µs/call
# spent 3.20ms making 324 calls to Class::MOP::Mixin::HasMethods::wrapped_method_metaclass, avg 10µs/call
# spent 3.17ms making 324 calls to Class::MOP::Mixin::HasMethods::method_metaclass, avg 10µs/call
# spent 3.14ms making 266 calls to Moose::Meta::Class::error_class, avg 12µs/call
# spent 3.09ms making 266 calls to Moose::Meta::Class::destructor_class, avg 12µs/call
# spent 3.07ms making 324 calls to Class::MOP::Mixin::HasAttributes::attribute_metaclass, avg 9µs/call
# spent 3.00ms making 324 calls to Class::MOP::Class::instance_metaclass, avg 9µs/call
# spent 274µs making 29 calls to Class::MOP::Class::constructor_class, avg 9µs/call | ||
| 306 | } | ||||
| 307 | |||||
| 308 | # spent 366ms (12.6+353) within Class::MOP::Class::_fix_metaclass_incompatibility which was called 184 times, avg 1.99ms/call:
# 184 times (12.6ms+353ms) by Class::MOP::Class::_check_metaclass_compatibility at line 216, avg 1.99ms/call | ||||
| 309 | 920 | 5.91ms | my $self = shift; | ||
| 310 | 205 | 2.53ms | 205 | 8.85ms | my @supers = map { Class::MOP::Class->initialize($_) } @_; # spent 13.4ms making 205 calls to Class::MOP::Class::initialize, avg 65µs/call, recursion: max depth 1, sum of overlapping time 4.58ms |
| 311 | |||||
| 312 | my $necessary = 0; | ||||
| 313 | for my $super (@supers) { | ||||
| 314 | 205 | 3.42ms | 205 | 343ms | $necessary = 1 # spent 343ms making 205 calls to Class::MOP::Class::_can_fix_metaclass_incompatibility, avg 1.67ms/call |
| 315 | if $self->_can_fix_metaclass_incompatibility($super); | ||||
| 316 | } | ||||
| 317 | return unless $necessary; | ||||
| 318 | |||||
| 319 | for my $super (@supers) { | ||||
| 320 | if (!$self->_class_metaclass_is_compatible($super->name)) { | ||||
| 321 | $self->_fix_class_metaclass_incompatibility($super); | ||||
| 322 | } | ||||
| 323 | } | ||||
| 324 | |||||
| 325 | my %base_metaclass = $self->_base_metaclasses; | ||||
| 326 | for my $metaclass_type (keys %base_metaclass) { | ||||
| 327 | for my $super (@supers) { | ||||
| 328 | if (!$self->_single_metaclass_is_compatible($metaclass_type, $super->name)) { | ||||
| 329 | $self->_fix_single_metaclass_incompatibility( | ||||
| 330 | $metaclass_type, $super | ||||
| 331 | ); | ||||
| 332 | } | ||||
| 333 | } | ||||
| 334 | } | ||||
| 335 | } | ||||
| 336 | |||||
| 337 | # spent 343ms (37.0+306) within Class::MOP::Class::_can_fix_metaclass_incompatibility which was called 205 times, avg 1.67ms/call:
# 205 times (37.0ms+306ms) by Class::MOP::Class::_fix_metaclass_incompatibility at line 314, avg 1.67ms/call | ||||
| 338 | 1230 | 13.7ms | my $self = shift; | ||
| 339 | my ($super_meta) = @_; | ||||
| 340 | |||||
| 341 | 205 | 28.7ms | return 1 if $self->_class_metaclass_can_be_made_compatible($super_meta); # spent 28.7ms making 205 calls to Class::MOP::Class::_class_metaclass_can_be_made_compatible, avg 140µs/call | ||
| 342 | |||||
| 343 | 205 | 38.3ms | my %base_metaclass = $self->_base_metaclasses; # spent 37.5ms making 162 calls to Moose::Meta::Class::_base_metaclasses, avg 232µs/call
# spent 765µs making 43 calls to Class::MOP::Class::_base_metaclasses, avg 18µs/call | ||
| 344 | for my $metaclass_type (keys %base_metaclass) { | ||||
| 345 | 1392 | 19.4ms | 1392 | 239ms | return 1 if $self->_single_metaclass_can_be_made_compatible($super_meta, $metaclass_type); # spent 239ms making 1392 calls to Class::MOP::Class::_single_metaclass_can_be_made_compatible, avg 171µs/call |
| 346 | } | ||||
| 347 | |||||
| 348 | return; | ||||
| 349 | } | ||||
| 350 | |||||
| 351 | # spent 28.7ms (7.28+21.4) within Class::MOP::Class::_class_metaclass_can_be_made_compatible which was called 205 times, avg 140µs/call:
# 205 times (7.28ms+21.4ms) by Class::MOP::Class::_can_fix_metaclass_incompatibility at line 341, avg 140µs/call | ||||
| 352 | 615 | 7.16ms | my $self = shift; | ||
| 353 | my ($super_meta) = @_; | ||||
| 354 | |||||
| 355 | 410 | 21.4ms | return $self->_can_be_made_compatible_with($super_meta->_real_ref_name); # spent 12.1ms making 205 calls to Class::MOP::Object::_can_be_made_compatible_with, avg 59µs/call
# spent 9.30ms making 205 calls to Class::MOP::Class::_real_ref_name, avg 45µs/call | ||
| 356 | } | ||||
| 357 | |||||
| 358 | # spent 239ms (126+113) within Class::MOP::Class::_single_metaclass_can_be_made_compatible which was called 1392 times, avg 171µs/call:
# 1392 times (126ms+113ms) by Class::MOP::Class::_can_fix_metaclass_incompatibility at line 345, avg 171µs/call | ||||
| 359 | 10876 | 124ms | my $self = shift; | ||
| 360 | my ($super_meta, $metaclass_type) = @_; | ||||
| 361 | |||||
| 362 | 1392 | 16.4ms | my $specific_meta = $self->$metaclass_type; # spent 2.46ms making 205 calls to Class::MOP::Mixin::HasMethods::wrapped_method_metaclass, avg 12µs/call
# spent 2.36ms making 205 calls to Class::MOP::Mixin::HasMethods::method_metaclass, avg 12µs/call
# spent 2.35ms making 205 calls to Class::MOP::Mixin::HasAttributes::attribute_metaclass, avg 11µs/call
# spent 2.30ms making 162 calls to Moose::Meta::Class::error_class, avg 14µs/call
# spent 2.11ms making 162 calls to Moose::Meta::Class::destructor_class, avg 13µs/call
# spent 2.09ms making 162 calls to Moose::Meta::Class::constructor_class, avg 13µs/call
# spent 2.02ms making 205 calls to Class::MOP::Class::instance_metaclass, avg 10µs/call
# spent 374µs making 43 calls to Class::MOP::Class::constructor_class, avg 9µs/call
# spent 334µs making 43 calls to Class::MOP::Class::destructor_class, avg 8µs/call | ||
| 363 | |||||
| 364 | 1392 | 9.08ms | return unless $super_meta->can($metaclass_type); # spent 9.08ms making 1392 calls to UNIVERSAL::can, avg 7µs/call | ||
| 365 | 1363 | 14.6ms | my $super_specific_meta = $super_meta->$metaclass_type; # spent 2.14ms making 205 calls to Class::MOP::Mixin::HasMethods::method_metaclass, avg 10µs/call
# spent 2.14ms making 205 calls to Class::MOP::Mixin::HasMethods::wrapped_method_metaclass, avg 10µs/call
# spent 2.13ms making 205 calls to Class::MOP::Mixin::HasAttributes::attribute_metaclass, avg 10µs/call
# spent 1.98ms making 205 calls to Class::MOP::Class::instance_metaclass, avg 10µs/call
# spent 1.69ms making 133 calls to Moose::Meta::Class::destructor_class, avg 13µs/call
# spent 1.64ms making 133 calls to Moose::Meta::Class::error_class, avg 12µs/call
# spent 1.62ms making 133 calls to Moose::Meta::Class::constructor_class, avg 12µs/call
# spent 676µs making 72 calls to Class::MOP::Class::constructor_class, avg 9µs/call
# spent 598µs making 72 calls to Class::MOP::Class::destructor_class, avg 8µs/call | ||
| 366 | |||||
| 367 | # for instance, Moose::Meta::Class has a destructor_class, but | ||||
| 368 | # Class::MOP::Class doesn't - this shouldn't be an error | ||||
| 369 | return unless defined $super_specific_meta; | ||||
| 370 | |||||
| 371 | # if metaclass is defined in superclass but not here, it's fixable | ||||
| 372 | # this is a really odd case | ||||
| 373 | return 1 unless defined $specific_meta; | ||||
| 374 | |||||
| 375 | 1291 | 72.9ms | return 1 if $specific_meta->_can_be_made_compatible_with($super_specific_meta); # spent 72.9ms making 1291 calls to Class::MOP::Object::_can_be_made_compatible_with, avg 56µs/call | ||
| 376 | } | ||||
| 377 | |||||
| 378 | sub _fix_class_metaclass_incompatibility { | ||||
| 379 | my $self = shift; | ||||
| 380 | my ( $super_meta ) = @_; | ||||
| 381 | |||||
| 382 | if ($self->_class_metaclass_can_be_made_compatible($super_meta)) { | ||||
| 383 | ($self->is_pristine) | ||||
| 384 | || confess "Can't fix metaclass incompatibility for " | ||||
| 385 | . $self->name | ||||
| 386 | . " because it is not pristine."; | ||||
| 387 | |||||
| 388 | my $super_meta_name = $super_meta->_real_ref_name; | ||||
| 389 | |||||
| 390 | $self->_make_compatible_with($super_meta_name); | ||||
| 391 | } | ||||
| 392 | } | ||||
| 393 | |||||
| 394 | sub _fix_single_metaclass_incompatibility { | ||||
| 395 | my $self = shift; | ||||
| 396 | my ( $metaclass_type, $super_meta ) = @_; | ||||
| 397 | |||||
| 398 | if ($self->_single_metaclass_can_be_made_compatible($super_meta, $metaclass_type)) { | ||||
| 399 | ($self->is_pristine) | ||||
| 400 | || confess "Can't fix metaclass incompatibility for " | ||||
| 401 | . $self->name | ||||
| 402 | . " because it is not pristine."; | ||||
| 403 | |||||
| 404 | my $new_metaclass = $self->$metaclass_type | ||||
| 405 | ? $self->$metaclass_type->_get_compatible_metaclass($super_meta->$metaclass_type) | ||||
| 406 | : $super_meta->$metaclass_type; | ||||
| 407 | $self->{$metaclass_type} = $new_metaclass; | ||||
| 408 | } | ||||
| 409 | } | ||||
| 410 | |||||
| 411 | # spent 214ms (2.35+212) within Class::MOP::Class::_restore_metaobjects_from which was called 42 times, avg 5.11ms/call:
# 42 times (2.35ms+212ms) by Class::MOP::Class::reinitialize at line 63, avg 5.11ms/call | ||||
| 412 | 168 | 2.24ms | my $self = shift; | ||
| 413 | my ($old_meta) = @_; | ||||
| 414 | |||||
| 415 | 42 | 209ms | $self->_restore_metamethods_from($old_meta); # spent 209ms making 42 calls to Class::MOP::Mixin::HasMethods::_restore_metamethods_from, avg 4.96ms/call | ||
| 416 | 42 | 3.54ms | $self->_restore_metaattributes_from($old_meta); # spent 3.54ms making 42 calls to Class::MOP::Mixin::HasAttributes::_restore_metaattributes_from, avg 84µs/call | ||
| 417 | } | ||||
| 418 | |||||
| 419 | # spent 3.05ms (1.46+1.59) within Class::MOP::Class::_remove_generated_metaobjects which was called 42 times, avg 73µs/call:
# 42 times (1.46ms+1.59ms) by Class::MOP::Class::reinitialize at line 60, avg 73µs/call | ||||
| 420 | 84 | 1.23ms | my $self = shift; | ||
| 421 | |||||
| 422 | 42 | 1.59ms | for my $attr (map { $self->get_attribute($_) } $self->get_attribute_list) { # spent 1.59ms making 42 calls to Class::MOP::Mixin::HasAttributes::get_attribute_list, avg 38µs/call | ||
| 423 | $attr->remove_accessors; | ||||
| 424 | } | ||||
| 425 | } | ||||
| 426 | |||||
| 427 | ## ANON classes | ||||
| 428 | |||||
| 429 | { | ||||
| 430 | # NOTE: | ||||
| 431 | # this should be sufficient, if you have a | ||||
| 432 | # use case where it is not, write a test and | ||||
| 433 | # I will change it. | ||||
| 434 | 3 | 10µs | my $ANON_CLASS_SERIAL = 0; | ||
| 435 | |||||
| 436 | # NOTE: | ||||
| 437 | # we need a sufficiently annoying prefix | ||||
| 438 | # this should suffice for now, this is | ||||
| 439 | # used in a couple of places below, so | ||||
| 440 | # need to put it up here for now. | ||||
| 441 | my $ANON_CLASS_PREFIX = 'Class::MOP::Class::__ANON__::SERIAL::'; | ||||
| 442 | |||||
| 443 | # spent 1.81ms (1.35+459µs) within Class::MOP::Class::is_anon_class which was called 42 times, avg 43µs/call:
# 42 times (1.35ms+459µs) by Moose::Meta::Class::reinitialize at line 153 of Moose/Meta/Class.pm, avg 43µs/call | ||||
| 444 | 84 | 1.85ms | my $self = shift; | ||
| 445 | 3 | 433µs | 2 | 209µs | # spent 132µs (55+77) within Class::MOP::Class::BEGIN@445 which was called:
# once (55µs+77µs) by Class::MOP::BEGIN@19 at line 445 # spent 132µs making 1 call to Class::MOP::Class::BEGIN@445
# spent 77µs making 1 call to warnings::unimport |
| 446 | 85 | 459µs | $self->name =~ /^$ANON_CLASS_PREFIX/o; # spent 238µs making 42 calls to Class::MOP::Package::name, avg 6µs/call
# spent 178µs making 42 calls to Class::MOP::Class::CORE:match, avg 4µs/call
# spent 42µs making 1 call to Class::MOP::Class::CORE:regcomp | ||
| 447 | } | ||||
| 448 | |||||
| 449 | # spent 1.17s (1.05ms+1.17) within Class::MOP::Class::create_anon_class which was called 22 times, avg 53.3ms/call:
# 22 times (1.05ms+1.17s) by Moose::Meta::Class::create_anon_class at line 111 of Moose/Meta/Class.pm, avg 53.3ms/call | ||||
| 450 | 88 | 994µs | my ($class, %options) = @_; | ||
| 451 | $options{weaken} = 1 unless exists $options{weaken}; | ||||
| 452 | my $package_name = $ANON_CLASS_PREFIX . ++$ANON_CLASS_SERIAL; | ||||
| 453 | 22 | 1.17s | return $class->create($package_name, %options); # spent 1.17s making 22 calls to Moose::Meta::Class::create, avg 53.2ms/call | ||
| 454 | } | ||||
| 455 | |||||
| 456 | # NOTE: | ||||
| 457 | # this will only get called for | ||||
| 458 | # anon-classes, all other calls | ||||
| 459 | # are assumed to occur during | ||||
| 460 | # global destruction and so don't | ||||
| 461 | # really need to be handled explicitly | ||||
| 462 | # spent 2.80ms (2.04+762µs) within Class::MOP::Class::DESTROY which was called 42 times, avg 67µs/call:
# 42 times (2.04ms+762µs) by Moose::Util::MetaRole::apply_metaroles at line 627 of Moose/Exporter.pm, avg 67µs/call | ||||
| 463 | 168 | 2.74ms | my $self = shift; | ||
| 464 | |||||
| 465 | 42 | 311µs | return if in_global_destruction(); # it'll happen soon anyway and this just makes things more complicated # spent 311µs making 42 calls to Devel::GlobalDestruction::in_global_destruction, avg 7µs/call | ||
| 466 | |||||
| 467 | 3 | 276µs | 2 | 157µs | # spent 99µs (40+58) within Class::MOP::Class::BEGIN@467 which was called:
# once (40µs+58µs) by Class::MOP::BEGIN@19 at line 467 # spent 99µs making 1 call to Class::MOP::Class::BEGIN@467
# spent 58µs making 1 call to warnings::unimport |
| 468 | 42 | 288µs | my $name = $self->name; # spent 288µs making 42 calls to Class::MOP::Package::name, avg 7µs/call | ||
| 469 | 43 | 164µs | return unless $name =~ /^$ANON_CLASS_PREFIX/o; # spent 121µs making 42 calls to Class::MOP::Class::CORE:match, avg 3µs/call
# spent 42µs making 1 call to Class::MOP::Class::CORE:regcomp | ||
| 470 | |||||
| 471 | # Moose does a weird thing where it replaces the metaclass for | ||||
| 472 | # class when fixing metaclass incompatibility. In that case, | ||||
| 473 | # we don't want to clean out the namespace now. We can detect | ||||
| 474 | # that because Moose will explicitly update the singleton | ||||
| 475 | # cache in Class::MOP. | ||||
| 476 | my $current_meta = Class::MOP::get_metaclass_by_name($name); | ||||
| 477 | return if $current_meta ne $self; | ||||
| 478 | |||||
| 479 | my ($serial_id) = ($name =~ /^$ANON_CLASS_PREFIX(\d+)/o); | ||||
| 480 | 3 | 14.3ms | 2 | 188µs | # spent 119µs (49+70) within Class::MOP::Class::BEGIN@480 which was called:
# once (49µs+70µs) by Class::MOP::BEGIN@19 at line 480 # spent 119µs making 1 call to Class::MOP::Class::BEGIN@480
# spent 70µs making 1 call to strict::unimport |
| 481 | @{$name . '::ISA'} = (); | ||||
| 482 | %{$name . '::'} = (); | ||||
| 483 | delete ${$ANON_CLASS_PREFIX}{$serial_id . '::'}; | ||||
| 484 | |||||
| 485 | Class::MOP::remove_metaclass_by_name($name); | ||||
| 486 | } | ||||
| 487 | |||||
| 488 | } | ||||
| 489 | |||||
| 490 | # creating classes with MOP ... | ||||
| 491 | |||||
| 492 | # spent 343ms (4.21+338) within Class::MOP::Class::create which was called 24 times, avg 14.3ms/call:
# 22 times (3.87ms+327ms) by Moose::Meta::Class::create at line 85 of Moose/Meta/Class.pm, avg 15.0ms/call
# 2 times (347µs+11.6ms) by Class::MOP::Class::_immutable_metaclass at line 1246, avg 5.98ms/call | ||||
| 493 | 408 | 3.98ms | my ( $class, @args ) = @_; | ||
| 494 | |||||
| 495 | unshift @args, 'package' if @args % 2 == 1; | ||||
| 496 | |||||
| 497 | my (%options) = @args; | ||||
| 498 | my $package_name = $options{package}; | ||||
| 499 | |||||
| 500 | (ref $options{superclasses} eq 'ARRAY') | ||||
| 501 | || confess "You must pass an ARRAY ref of superclasses" | ||||
| 502 | if exists $options{superclasses}; | ||||
| 503 | |||||
| 504 | (ref $options{attributes} eq 'ARRAY') | ||||
| 505 | || confess "You must pass an ARRAY ref of attributes" | ||||
| 506 | if exists $options{attributes}; | ||||
| 507 | |||||
| 508 | (ref $options{methods} eq 'HASH') | ||||
| 509 | || confess "You must pass a HASH ref of methods" | ||||
| 510 | if exists $options{methods}; | ||||
| 511 | |||||
| 512 | $options{meta_name} = 'meta' | ||||
| 513 | unless exists $options{meta_name}; | ||||
| 514 | |||||
| 515 | my (%initialize_options) = @args; | ||||
| 516 | delete @initialize_options{qw( | ||||
| 517 | package | ||||
| 518 | superclasses | ||||
| 519 | attributes | ||||
| 520 | methods | ||||
| 521 | meta_name | ||||
| 522 | version | ||||
| 523 | authority | ||||
| 524 | )}; | ||||
| 525 | 24 | 94.3ms | my $meta = $class->initialize( $package_name => %initialize_options ); # spent 93.0ms making 22 calls to Moose::Meta::Class::initialize, avg 4.23ms/call
# spent 1.25ms making 2 calls to Class::MOP::Class::initialize, avg 626µs/call | ||
| 526 | |||||
| 527 | 24 | 3.00ms | $meta->_instantiate_module( $options{version}, $options{authority} ); # spent 3.00ms making 24 calls to Class::MOP::Module::_instantiate_module, avg 125µs/call | ||
| 528 | |||||
| 529 | 24 | 67.6ms | $meta->_add_meta_method($options{meta_name}) # spent 67.6ms making 24 calls to Class::MOP::Mixin::HasMethods::_add_meta_method, avg 2.82ms/call | ||
| 530 | if defined $options{meta_name}; | ||||
| 531 | |||||
| 532 | 24 | 173ms | $meta->superclasses(@{$options{superclasses}}) # spent 169ms making 22 calls to Moose::Meta::Class::superclasses, avg 7.66ms/call
# spent 4.91ms making 2 calls to Class::MOP::Class::superclasses, avg 2.45ms/call | ||
| 533 | if exists $options{superclasses}; | ||||
| 534 | # NOTE: | ||||
| 535 | # process attributes first, so that they can | ||||
| 536 | # install accessors, but locally defined methods | ||||
| 537 | # can then overwrite them. It is maybe a little odd, but | ||||
| 538 | # I think this should be the order of things. | ||||
| 539 | if (exists $options{attributes}) { | ||||
| 540 | foreach my $attr (@{$options{attributes}}) { | ||||
| 541 | $meta->add_attribute($attr); | ||||
| 542 | } | ||||
| 543 | } | ||||
| 544 | if (exists $options{methods}) { | ||||
| 545 | foreach my $method_name (keys %{$options{methods}}) { | ||||
| 546 | $meta->add_method($method_name, $options{methods}->{$method_name}); | ||||
| 547 | } | ||||
| 548 | } | ||||
| 549 | return $meta; | ||||
| 550 | } | ||||
| 551 | |||||
| 552 | ## Attribute readers | ||||
| 553 | |||||
| 554 | # NOTE: | ||||
| 555 | # all these attribute readers will be bootstrapped | ||||
| 556 | # away in the Class::MOP bootstrap section | ||||
| 557 | |||||
| 558 | 1641 | 22.8ms | sub instance_metaclass { $_[0]->{'instance_metaclass'} } | ||
| 559 | 102 | 1.44ms | sub immutable_trait { $_[0]->{'immutable_trait'} } | ||
| 560 | 258 | 3.37ms | sub constructor_class { $_[0]->{'constructor_class'} } | ||
| 561 | 93 | 1.22ms | sub constructor_name { $_[0]->{'constructor_name'} } | ||
| 562 | 229 | 2.72ms | sub destructor_class { $_[0]->{'destructor_class'} } | ||
| 563 | |||||
| 564 | # Instance Construction & Cloning | ||||
| 565 | |||||
| 566 | # spent 641ms (16.3+625) within Class::MOP::Class::new_object which was called 330 times, avg 1.94ms/call:
# 192 times (9.42ms+244ms) by Moose::Meta::Method::_new at line 4 of (eval 76)[Class/MOP/Method/Generated.pm:53], avg 1.32ms/call
# 110 times (5.54ms+344ms) by Moose::Meta::Class::new_object at line 256 of Moose/Meta/Class.pm, avg 3.18ms/call
# 26 times (1.27ms+31.3ms) by Class::MOP::Method::_new at line 54 of Class/MOP/Method.pm, avg 1.25ms/call
# once (67µs+4.21ms) by Class::MOP::Attribute::_new at line 62 of Class/MOP/Attribute.pm
# once (52µs+1.40ms) by Class::MOP::Object::_new at line 22 of Class/MOP/Object.pm | ||||
| 567 | 990 | 23.5ms | my $class = shift; | ||
| 568 | |||||
| 569 | # NOTE: | ||||
| 570 | # we need to protect the integrity of the | ||||
| 571 | # Class::MOP::Class singletons here, so we | ||||
| 572 | # delegate this to &construct_class_instance | ||||
| 573 | # which will deal with the singletons | ||||
| 574 | 660 | 7.01ms | return $class->_construct_class_instance(@_) # spent 5.02ms making 330 calls to UNIVERSAL::isa, avg 15µs/call
# spent 1.99ms making 330 calls to Class::MOP::Package::name, avg 6µs/call | ||
| 575 | if $class->name->isa('Class::MOP::Class'); | ||||
| 576 | 330 | 618ms | return $class->_construct_instance(@_); # spent 618ms making 330 calls to Class::MOP::Class::_construct_instance, avg 1.87ms/call | ||
| 577 | } | ||||
| 578 | |||||
| 579 | # spent 1.01s (153ms+855ms) within Class::MOP::Class::_construct_instance which was called 440 times, avg 2.29ms/call:
# 330 times (83.2ms+535ms) by Class::MOP::Class::new_object at line 576, avg 1.87ms/call
# 110 times (69.6ms+320ms) by Class::MOP::Class::_construct_class_instance at line 105, avg 3.54ms/call | ||||
| 580 | 3520 | 74.9ms | my $class = shift; | ||
| 581 | my $params = @_ == 1 ? $_[0] : {@_}; | ||||
| 582 | 440 | 24.4ms | my $meta_instance = $class->get_meta_instance(); # spent 13.5ms making 267 calls to Class::MOP::Class::get_meta_instance, avg 51µs/call
# spent 8.05ms making 129 calls to Class::MOP::Class::Immutable::Class::MOP::Class::get_meta_instance, avg 62µs/call
# spent 2.84ms making 44 calls to Class::MOP::Class::Immutable::Moose::Meta::Class::get_meta_instance, avg 64µs/call | ||
| 583 | # FIXME: | ||||
| 584 | # the code below is almost certainly incorrect | ||||
| 585 | # but this is foreign inheritance, so we might | ||||
| 586 | # have to kludge it in the end. | ||||
| 587 | my $instance; | ||||
| 588 | 440 | 5.92ms | 440 | 3.48ms | if (my $instance_class = blessed($params->{__INSTANCE__})) { # spent 3.48ms making 440 calls to Scalar::Util::blessed, avg 8µs/call |
| 589 | ($instance_class eq $class->name) | ||||
| 590 | || confess "Objects passed as the __INSTANCE__ parameter must " | ||||
| 591 | . "already be blessed into the correct class, but " | ||||
| 592 | . "$params->{__INSTANCE__} is not a " . $class->name; | ||||
| 593 | $instance = $params->{__INSTANCE__}; | ||||
| 594 | } | ||||
| 595 | elsif (exists $params->{__INSTANCE__}) { | ||||
| 596 | confess "The __INSTANCE__ parameter must be a blessed reference, not " | ||||
| 597 | . $params->{__INSTANCE__}; | ||||
| 598 | } | ||||
| 599 | else { | ||||
| 600 | 440 | 24.5ms | $instance = $meta_instance->create_instance(); # spent 24.5ms making 440 calls to Class::MOP::Instance::create_instance, avg 56µs/call | ||
| 601 | } | ||||
| 602 | 440 | 146ms | foreach my $attr ($class->get_all_attributes()) { # spent 132ms making 267 calls to Class::MOP::Class::get_all_attributes, avg 494µs/call
# spent 9.77ms making 129 calls to Class::MOP::Class::Immutable::Class::MOP::Class::get_all_attributes, avg 76µs/call
# spent 4.68ms making 44 calls to Class::MOP::Class::Immutable::Moose::Meta::Class::get_all_attributes, avg 106µs/call | ||
| 603 | 4814 | 66.1ms | 4814 | 640ms | $attr->initialize_instance_slot($meta_instance, $instance, $params); # spent 573ms making 4704 calls to Class::MOP::Attribute::initialize_instance_slot, avg 122µs/call
# spent 67.0ms making 110 calls to Moose::Meta::Attribute::initialize_instance_slot, avg 609µs/call |
| 604 | } | ||||
| 605 | 922 | 15.8ms | if (Class::MOP::metaclass_is_weak($class->name)) { # spent 11.2ms making 440 calls to Class::MOP::metaclass_is_weak, avg 26µs/call
# spent 2.61ms making 440 calls to Class::MOP::Package::name, avg 6µs/call
# spent 1.95ms making 42 calls to Class::MOP::Instance::_set_mop_slot, avg 46µs/call | ||
| 606 | $meta_instance->_set_mop_slot($instance, $class); | ||||
| 607 | } | ||||
| 608 | return $instance; | ||||
| 609 | } | ||||
| 610 | |||||
| 611 | |||||
| 612 | # spent 150ms (12.2+138) within Class::MOP::Class::get_meta_instance which was called 787 times, avg 191µs/call:
# 267 times (3.69ms+9.85ms) by Class::MOP::Class::_construct_instance at line 582, avg 51µs/call
# 154 times (3.04ms+68.9ms) by Class::MOP::Attribute::inline_get at line 411 of Class/MOP/Attribute.pm, avg 467µs/call
# 128 times (1.74ms+7.60ms) by Class::MOP::Attribute::inline_set at line 419 of Class/MOP/Attribute.pm, avg 73µs/call
# 93 times (1.42ms+17.9ms) by Moose::Meta::Attribute::inline_set at line 697 of Moose/Meta/Attribute.pm, avg 208µs/call
# 73 times (1.16ms+18.5ms) by Class::MOP::Class::inline_create_instance at line 634, avg 269µs/call
# 31 times (399µs+0s) by Class::MOP::Attribute::inline_has at line 428 of Class/MOP/Attribute.pm, avg 13µs/call
# 24 times (538µs+14.5ms) by Class::MOP::Class:::around at line 74 of Class/MOP/Class/Immutable/Trait.pm, avg 627µs/call
# 12 times (156µs+0s) by Class::MOP::Attribute::set_initial_value at line 253 of Class/MOP/Attribute.pm, avg 13µs/call
# 3 times (36µs+0s) by Class::MOP::Attribute::get_raw_value at line 274 of Class/MOP/Attribute.pm, avg 12µs/call
# once (24µs+759µs) by MooseX::Types::Combine::BEGIN@12 at line 684 of Class/MOP.pm
# once (14µs+0s) by Class::MOP::Attribute::has_value at line 282 of Class/MOP/Attribute.pm | ||||
| 613 | 1574 | 14.3ms | my $self = shift; | ||
| 614 | 137 | 138ms | $self->{'_meta_instance'} ||= $self->_create_meta_instance(); # spent 138ms making 137 calls to Class::MOP::Class::_create_meta_instance, avg 1.01ms/call | ||
| 615 | } | ||||
| 616 | |||||
| 617 | # spent 138ms (10.0+128) within Class::MOP::Class::_create_meta_instance which was called 137 times, avg 1.01ms/call:
# 137 times (10.0ms+128ms) by Class::MOP::Class::get_meta_instance at line 614, avg 1.01ms/call | ||||
| 618 | 548 | 8.64ms | my $self = shift; | ||
| 619 | |||||
| 620 | 411 | 127ms | my $instance = $self->instance_metaclass->new( # spent 65.5ms making 137 calls to Class::MOP::Instance::new, avg 478µs/call
# spent 52.8ms making 125 calls to Class::MOP::Class::get_all_attributes, avg 422µs/call
# spent 7.19ms making 12 calls to Class::MOP::Class::Immutable::Class::MOP::Class::get_all_attributes, avg 599µs/call
# spent 1.34ms making 137 calls to Class::MOP::Class::instance_metaclass, avg 10µs/call | ||
| 621 | associated_metaclass => $self, | ||||
| 622 | attributes => [ $self->get_all_attributes() ], | ||||
| 623 | ); | ||||
| 624 | |||||
| 625 | 137 | 1.15ms | $self->add_meta_instance_dependencies() # spent 1.15ms making 137 calls to Class::MOP::Instance::is_dependent_on_superclasses, avg 8µs/call | ||
| 626 | if $instance->is_dependent_on_superclasses(); | ||||
| 627 | |||||
| 628 | return $instance; | ||||
| 629 | } | ||||
| 630 | |||||
| 631 | # spent 23.6ms (2.88+20.7) within Class::MOP::Class::inline_create_instance which was called 73 times, avg 323µs/call:
# 42 times (1.61ms+12.3ms) by Moose::Meta::Method::Constructor::_generate_instance at line 132 of Moose/Meta/Method/Constructor.pm, avg 330µs/call
# 31 times (1.26ms+8.48ms) by Class::MOP::Method::Constructor::_generate_constructor_method_inline at line 112 of Class/MOP/Method/Constructor.pm, avg 314µs/call | ||||
| 632 | 146 | 2.47ms | my $self = shift; | ||
| 633 | |||||
| 634 | 146 | 20.7ms | return $self->get_meta_instance->inline_create_instance(@_); # spent 19.6ms making 73 calls to Class::MOP::Class::get_meta_instance, avg 269µs/call
# spent 1.09ms making 73 calls to Class::MOP::Instance::inline_create_instance, avg 15µs/call | ||
| 635 | } | ||||
| 636 | |||||
| 637 | sub inline_rebless_instance { | ||||
| 638 | my $self = shift; | ||||
| 639 | |||||
| 640 | return $self->get_meta_instance->inline_rebless_instance_structure(@_); | ||||
| 641 | } | ||||
| 642 | |||||
| 643 | sub _inline_get_mop_slot { | ||||
| 644 | my $self = shift; | ||||
| 645 | |||||
| 646 | return $self->get_meta_instance->_inline_get_mop_slot(@_); | ||||
| 647 | } | ||||
| 648 | |||||
| 649 | sub _inline_set_mop_slot { | ||||
| 650 | my $self = shift; | ||||
| 651 | |||||
| 652 | return $self->get_meta_instance->_inline_set_mop_slot(@_); | ||||
| 653 | } | ||||
| 654 | |||||
| 655 | sub _inline_clear_mop_slot { | ||||
| 656 | my $self = shift; | ||||
| 657 | |||||
| 658 | return $self->get_meta_instance->_inline_clear_mop_slot(@_); | ||||
| 659 | } | ||||
| 660 | |||||
| 661 | # spent 1.30ms (111µs+1.18) within Class::MOP::Class::clone_object which was called:
# once (111µs+1.18ms) by Class::MOP::Attribute::clone at line 516 of Class/MOP.pm | ||||
| 662 | 5 | 135µs | my $class = shift; | ||
| 663 | my $instance = shift; | ||||
| 664 | 3 | 18µs | (blessed($instance) && $instance->isa($class->name)) # spent 6µs making 1 call to Class::MOP::Package::name
# spent 6µs making 1 call to Scalar::Util::blessed
# spent 6µs making 1 call to UNIVERSAL::isa | ||
| 665 | || confess "You must pass an instance of the metaclass (" . (ref $class ? $class->name : $class) . "), not ($instance)"; | ||||
| 666 | |||||
| 667 | # NOTE: | ||||
| 668 | # we need to protect the integrity of the | ||||
| 669 | # Class::MOP::Class singletons here, they | ||||
| 670 | # should not be cloned. | ||||
| 671 | 1 | 7µs | return $instance if $instance->isa('Class::MOP::Class'); # spent 7µs making 1 call to UNIVERSAL::isa | ||
| 672 | 1 | 1.16ms | $class->_clone_instance($instance, @_); # spent 1.16ms making 1 call to Class::MOP::Class::_clone_instance | ||
| 673 | } | ||||
| 674 | |||||
| 675 | # spent 1.16ms (371µs+787µs) within Class::MOP::Class::_clone_instance which was called:
# once (371µs+787µs) by Class::MOP::Class::clone_object at line 672 | ||||
| 676 | 6 | 96µs | my ($class, $instance, %params) = @_; | ||
| 677 | 1 | 7µs | (blessed($instance)) # spent 7µs making 1 call to Scalar::Util::blessed | ||
| 678 | || confess "You can only clone instances, ($instance) is not a blessed instance"; | ||||
| 679 | 1 | 62µs | my $meta_instance = $class->get_meta_instance(); # spent 62µs making 1 call to Class::MOP::Class::Immutable::Class::MOP::Class::get_meta_instance | ||
| 680 | 1 | 149µs | my $clone = $meta_instance->clone_instance($instance); # spent 149µs making 1 call to Class::MOP::Instance::clone_instance | ||
| 681 | 1 | 60µs | foreach my $attr ($class->get_all_attributes()) { # spent 60µs making 1 call to Class::MOP::Class::Immutable::Class::MOP::Class::get_all_attributes | ||
| 682 | 14 | 213µs | 16 | 510µs | if ( defined( my $init_arg = $attr->init_arg ) ) { # spent 378µs making 2 calls to Class::MOP::Attribute::set_value, avg 189µs/call
# spent 132µs making 14 calls to Class::MOP::Mixin::AttributeCore::init_arg, avg 9µs/call |
| 683 | if (exists $params{$init_arg}) { | ||||
| 684 | $attr->set_value($clone, $params{$init_arg}); | ||||
| 685 | } | ||||
| 686 | } | ||||
| 687 | } | ||||
| 688 | return $clone; | ||||
| 689 | } | ||||
| 690 | |||||
| 691 | sub _force_rebless_instance { | ||||
| 692 | my ($self, $instance, %params) = @_; | ||||
| 693 | my $old_metaclass = Class::MOP::class_of($instance); | ||||
| 694 | |||||
| 695 | $old_metaclass->rebless_instance_away($instance, $self, %params) | ||||
| 696 | if $old_metaclass; | ||||
| 697 | |||||
| 698 | my $meta_instance = $self->get_meta_instance; | ||||
| 699 | |||||
| 700 | if (Class::MOP::metaclass_is_weak($old_metaclass->name)) { | ||||
| 701 | $meta_instance->_clear_mop_slot($instance); | ||||
| 702 | } | ||||
| 703 | |||||
| 704 | # rebless! | ||||
| 705 | # we use $_[1] here because of t/306_rebless_overload.t regressions on 5.8.8 | ||||
| 706 | $meta_instance->rebless_instance_structure($_[1], $self); | ||||
| 707 | |||||
| 708 | $self->_fixup_attributes_after_rebless($instance, $old_metaclass, %params); | ||||
| 709 | |||||
| 710 | if (Class::MOP::metaclass_is_weak($self->name)) { | ||||
| 711 | $meta_instance->_set_mop_slot($instance, $self); | ||||
| 712 | } | ||||
| 713 | } | ||||
| 714 | |||||
| 715 | sub rebless_instance { | ||||
| 716 | my ($self, $instance, %params) = @_; | ||||
| 717 | my $old_metaclass = Class::MOP::class_of($instance); | ||||
| 718 | |||||
| 719 | my $old_class = $old_metaclass ? $old_metaclass->name : blessed($instance); | ||||
| 720 | $self->name->isa($old_class) | ||||
| 721 | || confess "You may rebless only into a subclass of ($old_class), of which (". $self->name .") isn't."; | ||||
| 722 | |||||
| 723 | $self->_force_rebless_instance($_[1], %params); | ||||
| 724 | |||||
| 725 | return $instance; | ||||
| 726 | } | ||||
| 727 | |||||
| 728 | sub rebless_instance_back { | ||||
| 729 | my ( $self, $instance ) = @_; | ||||
| 730 | my $old_metaclass = Class::MOP::class_of($instance); | ||||
| 731 | |||||
| 732 | my $old_class | ||||
| 733 | = $old_metaclass ? $old_metaclass->name : blessed($instance); | ||||
| 734 | $old_class->isa( $self->name ) | ||||
| 735 | || confess | ||||
| 736 | "You may rebless only into a superclass of ($old_class), of which (" | ||||
| 737 | . $self->name | ||||
| 738 | . ") isn't."; | ||||
| 739 | |||||
| 740 | $self->_force_rebless_instance($_[1]); | ||||
| 741 | |||||
| 742 | return $instance; | ||||
| 743 | } | ||||
| 744 | |||||
| 745 | sub rebless_instance_away { | ||||
| 746 | # this intentionally does nothing, it is just a hook | ||||
| 747 | } | ||||
| 748 | |||||
| 749 | sub _fixup_attributes_after_rebless { | ||||
| 750 | my $self = shift; | ||||
| 751 | my ($instance, $rebless_from, %params) = @_; | ||||
| 752 | my $meta_instance = $self->get_meta_instance; | ||||
| 753 | |||||
| 754 | for my $attr ( $rebless_from->get_all_attributes ) { | ||||
| 755 | next if $self->find_attribute_by_name( $attr->name ); | ||||
| 756 | $meta_instance->deinitialize_slot( $instance, $_ ) for $attr->slots; | ||||
| 757 | } | ||||
| 758 | |||||
| 759 | foreach my $attr ( $self->get_all_attributes ) { | ||||
| 760 | if ( $attr->has_value($instance) ) { | ||||
| 761 | if ( defined( my $init_arg = $attr->init_arg ) ) { | ||||
| 762 | $params{$init_arg} = $attr->get_value($instance) | ||||
| 763 | unless exists $params{$init_arg}; | ||||
| 764 | } | ||||
| 765 | else { | ||||
| 766 | $attr->set_value($instance, $attr->get_value($instance)); | ||||
| 767 | } | ||||
| 768 | } | ||||
| 769 | } | ||||
| 770 | |||||
| 771 | foreach my $attr ($self->get_all_attributes) { | ||||
| 772 | $attr->initialize_instance_slot($meta_instance, $instance, \%params); | ||||
| 773 | } | ||||
| 774 | } | ||||
| 775 | |||||
| 776 | # spent 15.7ms (4.44+11.3) within Class::MOP::Class::_attach_attribute which was called 187 times, avg 84µs/call:
# 187 times (4.44ms+11.3ms) by Class::MOP::Mixin::HasAttributes::add_attribute at line 28 of Class/MOP/Mixin/HasAttributes.pm, avg 84µs/call | ||||
| 777 | 374 | 4.56ms | my ($self, $attribute) = @_; | ||
| 778 | 187 | 11.3ms | $attribute->attach_to_class($self); # spent 11.3ms making 187 calls to Class::MOP::Attribute::attach_to_class, avg 60µs/call | ||
| 779 | } | ||||
| 780 | |||||
| 781 | # spent 1.60s (11.9ms+1.59) within Class::MOP::Class::_post_add_attribute which was called 187 times, avg 8.56ms/call:
# 187 times (11.9ms+1.59s) by Class::MOP::Mixin::HasAttributes::add_attribute at line 45 of Class/MOP/Mixin/HasAttributes.pm, avg 8.56ms/call | ||||
| 782 | 561 | 11.2ms | my ( $self, $attribute ) = @_; | ||
| 783 | |||||
| 784 | 187 | 9.66ms | $self->invalidate_meta_instances; # spent 9.66ms making 187 calls to Class::MOP::Class::invalidate_meta_instances, avg 52µs/call | ||
| 785 | |||||
| 786 | # invalidate package flag here | ||||
| 787 | # spent 1.56s (8.33ms+1.55) within Class::MOP::Class::__ANON__[/home/doy/perl5/perlbrew/perls/perl-5.10.1/lib/site_perl/5.10.1/x86_64-linux/Class/MOP/Class.pm:790] which was called 187 times, avg 8.33ms/call:
# 187 times (8.33ms+1.55s) by Try::Tiny::try at line 76 of Try/Tiny.pm, avg 8.33ms/call | ||||
| 788 | 374 | 8.37ms | local $SIG{__DIE__}; | ||
| 789 | 187 | 1.55s | $attribute->install_accessors; # spent 424ms making 66 calls to Moose::Meta::Attribute::install_accessors, avg 6.43ms/call
# spent 248ms making 1 call to Class::MOP::Class::__ANON__::SERIAL::15::install_accessors
# spent 214ms making 1 call to Class::MOP::Class::__ANON__::SERIAL::19::install_accessors
# spent 187ms making 2 calls to Class::MOP::Class::__ANON__::SERIAL::5::install_accessors, avg 93.6ms/call
# spent 167ms making 115 calls to Class::MOP::Attribute::install_accessors, avg 1.45ms/call
# spent 155ms making 1 call to Class::MOP::Class::__ANON__::SERIAL::11::install_accessors
# spent 154ms making 1 call to Class::MOP::Class::__ANON__::SERIAL::8::install_accessors | ||
| 790 | } | ||||
| 791 | catch { | ||||
| 792 | $self->remove_attribute( $attribute->name ); | ||||
| 793 | die $_; | ||||
| 794 | 374 | 1.39s | }; # spent 1.57s making 187 calls to Try::Tiny::try, avg 8.42ms/call, recursion: max depth 1, sum of overlapping time 188ms
# spent 4.11ms making 187 calls to Try::Tiny::catch, avg 22µs/call | ||
| 795 | } | ||||
| 796 | |||||
| 797 | sub remove_attribute { | ||||
| 798 | my $self = shift; | ||||
| 799 | |||||
| 800 | my $removed_attribute = $self->SUPER::remove_attribute(@_) | ||||
| 801 | or return; | ||||
| 802 | |||||
| 803 | $self->invalidate_meta_instances; | ||||
| 804 | |||||
| 805 | $removed_attribute->remove_accessors; | ||||
| 806 | $removed_attribute->detach_from_class; | ||||
| 807 | |||||
| 808 | return$removed_attribute; | ||||
| 809 | } | ||||
| 810 | |||||
| 811 | # spent 76.6ms (21.7+54.8) within Class::MOP::Class::find_attribute_by_name which was called 178 times, avg 430µs/call:
# 93 times (6.42ms+16.7ms) by Class::MOP::Class::_immutable_metaclass at line 1223, avg 248µs/call
# 84 times (15.1ms+37.4ms) by Moose::Util::MetaRole::_make_new_metaclass at line 117 of Moose/Util/MetaRole.pm, avg 625µs/call
# once (242µs+691µs) by Moose::Meta::Class::_process_inherited_attribute at line 443 of Moose/Meta/Class.pm | ||||
| 812 | 398 | 3.64ms | my ( $self, $attr_name ) = @_; | ||
| 813 | |||||
| 814 | 178 | 11.4ms | foreach my $class ( $self->linearized_isa ) { # spent 11.2ms making 173 calls to Class::MOP::Class::Immutable::Class::MOP::Class::linearized_isa, avg 65µs/call
# spent 214µs making 5 calls to Class::MOP::Class::linearized_isa, avg 43µs/call | ||
| 815 | # fetch the meta-class ... | ||||
| 816 | 996 | 15.1ms | 498 | 19.6ms | my $meta = Class::MOP::Class->initialize($class); # spent 19.6ms making 498 calls to Class::MOP::Class::initialize, avg 39µs/call |
| 817 | 634 | 23.8ms | return $meta->get_attribute($attr_name) # spent 18.8ms making 498 calls to Class::MOP::Mixin::HasAttributes::has_attribute, avg 38µs/call
# spent 4.93ms making 136 calls to Class::MOP::Mixin::HasAttributes::get_attribute, avg 36µs/call | ||
| 818 | if $meta->has_attribute($attr_name); | ||||
| 819 | } | ||||
| 820 | |||||
| 821 | return; | ||||
| 822 | } | ||||
| 823 | |||||
| 824 | # spent 284ms (121+163) within Class::MOP::Class::get_all_attributes which was called 608 times, avg 467µs/call:
# 267 times (56.2ms+75.7ms) by Class::MOP::Class::_construct_instance at line 602, avg 494µs/call
# 125 times (22.5ms+30.3ms) by Class::MOP::Class::_create_meta_instance at line 620, avg 422µs/call
# 73 times (11.7ms+16.1ms) by Class::MOP::Method::Constructor::_attributes at line 77 of Class/MOP/Method/Constructor.pm, avg 381µs/call
# 66 times (13.2ms+17.5ms) by Moose::Meta::Class::new_object at line 258 of Moose/Meta/Class.pm, avg 465µs/call
# 34 times (4.69ms+6.66ms) by Markdent::Role::Event::__ANON__[/home/doy/perl5/perlbrew/perls/perl-5.10.1/lib/site_perl/5.10.1/Markdent/Role/Event.pm:88] at line 43 of Markdent/Role/Event.pm, avg 334µs/call
# 25 times (8.56ms+10.1ms) by Moose::Meta::Attribute::new at line 64 of Moose/Meta/Attribute.pm, avg 747µs/call
# 18 times (4.49ms+6.44ms) by Class::MOP::Class:::around at line 68 of Class/MOP/Class/Immutable/Trait.pm, avg 607µs/call | ||||
| 825 | 1824 | 36.1ms | my $self = shift; | ||
| 826 | 5372 | 71.2ms | 5980 | 162ms | my %attrs = map { %{ Class::MOP::Class->initialize($_)->_attribute_map } } # spent 107ms making 2686 calls to Class::MOP::Class::initialize, avg 40µs/call, recursion: max depth 1, sum of overlapping time 887µs
# spent 26.8ms making 590 calls to Class::MOP::Class::linearized_isa, avg 45µs/call
# spent 26.7ms making 2686 calls to Class::MOP::Mixin::HasAttributes::_attribute_map, avg 10µs/call
# spent 1.89ms making 15 calls to Class::MOP::Class::Immutable::Class::MOP::Class::linearized_isa, avg 126µs/call
# spent 374µs making 3 calls to Class::MOP::Class::Immutable::Moose::Meta::Class::linearized_isa, avg 125µs/call |
| 827 | reverse $self->linearized_isa; | ||||
| 828 | return values %attrs; | ||||
| 829 | } | ||||
| 830 | |||||
| 831 | # Inheritance | ||||
| 832 | |||||
| 833 | sub superclasses { | ||||
| 834 | 3544 | 38.0ms | my $self = shift; | ||
| 835 | |||||
| 836 | 886 | 135ms | my $isa = $self->get_or_add_package_symbol( # spent 135ms making 886 calls to Class::MOP::Package::get_or_add_package_symbol, avg 153µs/call | ||
| 837 | { sigil => '@', type => 'ARRAY', name => 'ISA' } ); | ||||
| 838 | |||||
| 839 | 660 | 17.1ms | if (@_) { | ||
| 840 | my @supers = @_; | ||||
| 841 | @{$isa} = @supers; | ||||
| 842 | |||||
| 843 | # NOTE: | ||||
| 844 | # on 5.8 and below, we need to call | ||||
| 845 | # a method to get Perl to detect | ||||
| 846 | # a cycle in the class hierarchy | ||||
| 847 | 110 | 735µs | my $class = $self->name; # spent 735µs making 110 calls to Class::MOP::Package::name, avg 7µs/call | ||
| 848 | 110 | 1.00ms | $class->isa($class); # spent 1.00ms making 110 calls to UNIVERSAL::isa, avg 9µs/call | ||
| 849 | |||||
| 850 | # NOTE: | ||||
| 851 | # we need to check the metaclass | ||||
| 852 | # compatibility here so that we can | ||||
| 853 | # be sure that the superclass is | ||||
| 854 | # not potentially creating an issues | ||||
| 855 | # we don't know about | ||||
| 856 | |||||
| 857 | 110 | 551ms | $self->_check_metaclass_compatibility(); # spent 551ms making 110 calls to Class::MOP::Class::_check_metaclass_compatibility, avg 5.01ms/call | ||
| 858 | 110 | 46.3ms | $self->_superclasses_updated(); # spent 46.3ms making 110 calls to Class::MOP::Class::_superclasses_updated, avg 421µs/call | ||
| 859 | } | ||||
| 860 | |||||
| 861 | return @{$isa}; | ||||
| 862 | } | ||||
| 863 | |||||
| 864 | # spent 46.3ms (8.08+38.3) within Class::MOP::Class::_superclasses_updated which was called 110 times, avg 421µs/call:
# 110 times (8.08ms+38.3ms) by Class::MOP::Class::superclasses at line 858, avg 421µs/call | ||||
| 865 | 330 | 5.38ms | my $self = shift; | ||
| 866 | 110 | 1.28ms | $self->update_meta_instance_dependencies(); # spent 1.28ms making 110 calls to Class::MOP::Class::update_meta_instance_dependencies, avg 12µs/call | ||
| 867 | # keep strong references to all our parents, so they don't disappear if | ||||
| 868 | # they are anon classes and don't have any direct instances | ||||
| 869 | 122 | 4.20ms | $self->_superclass_metas( # spent 4.20ms making 122 calls to Class::MOP::class_of, avg 34µs/call | ||
| 870 | 122 | 1.41ms | 220 | 1.77ms | map { Class::MOP::class_of($_) } $self->superclasses # spent 1.77ms making 110 calls to Class::MOP::Class::_superclass_metas, avg 16µs/call
# spent 314µs making 2 calls to Class::MOP::Class::superclasses, avg 157µs/call, recursion: max depth 1, sum of overlapping time 314µs
# spent 30.7ms making 108 calls to Moose::Meta::Class::superclasses, avg 284µs/call, recursion: max depth 1, sum of overlapping time 30.7ms |
| 871 | ); | ||||
| 872 | } | ||||
| 873 | |||||
| 874 | # spent 1.77ms within Class::MOP::Class::_superclass_metas which was called 110 times, avg 16µs/call:
# 110 times (1.77ms+0s) by Class::MOP::Class::_superclasses_updated at line 870, avg 16µs/call | ||||
| 875 | 220 | 2.09ms | my $self = shift; | ||
| 876 | $self->{_superclass_metas} = [@_]; | ||||
| 877 | } | ||||
| 878 | |||||
| 879 | sub subclasses { | ||||
| 880 | my $self = shift; | ||||
| 881 | my $super_class = $self->name; | ||||
| 882 | |||||
| 883 | return @{ $super_class->mro::get_isarev() }; | ||||
| 884 | } | ||||
| 885 | |||||
| 886 | sub direct_subclasses { | ||||
| 887 | my $self = shift; | ||||
| 888 | my $super_class = $self->name; | ||||
| 889 | |||||
| 890 | return grep { | ||||
| 891 | grep { | ||||
| 892 | $_ eq $super_class | ||||
| 893 | } Class::MOP::Class->initialize($_)->superclasses | ||||
| 894 | } $self->subclasses; | ||||
| 895 | } | ||||
| 896 | |||||
| 897 | # spent 56.0ms (35.4+20.6) within Class::MOP::Class::linearized_isa which was called 1203 times, avg 47µs/call:
# 590 times (17.1ms+9.71ms) by Class::MOP::Class::get_all_attributes at line 826, avg 45µs/call
# 253 times (7.82ms+4.58ms) by Class::MOP::Class::find_next_method_by_name at line 1064, avg 49µs/call
# 248 times (7.29ms+4.39ms) by Class::MOP::Class::find_method_by_name at line 1017, avg 47µs/call
# 81 times (2.21ms+1.35ms) by Class::MOP::Class::find_all_methods_by_name at line 1048, avg 44µs/call
# 18 times (607µs+339µs) by Class::MOP::Class:::around at line 50 of Class/MOP/Class/Immutable/Trait.pm, avg 53µs/call
# 8 times (228µs+136µs) by Class::MOP::Class::get_all_methods at line 1028, avg 45µs/call
# 5 times (141µs+73µs) by Class::MOP::Class::find_attribute_by_name at line 814, avg 43µs/call | ||||
| 898 | 1203 | 60.1ms | 2406 | 20.6ms | return @{ mro::get_linear_isa( (shift)->name ) }; # spent 14.3ms making 1203 calls to mro::get_linear_isa, avg 12µs/call
# spent 6.32ms making 1203 calls to Class::MOP::Package::name, avg 5µs/call |
| 899 | } | ||||
| 900 | |||||
| 901 | # spent 119ms (25.1+93.5) within Class::MOP::Class::class_precedence_list which was called 295 times, avg 402µs/call:
# 159 times (11.6ms+-11.6ms) by Class::MOP::Class::class_precedence_list at line 927, avg 0s/call
# 73 times (7.46ms+81.4ms) by Moose::Meta::Class::excludes_role at line 239 of Moose/Meta/Class.pm, avg 1.22ms/call
# 44 times (4.11ms+25.6ms) by Moose::Meta::Class::does_role at line 219 of Moose/Meta/Class.pm, avg 675µs/call
# 19 times (1.89ms+-1.89ms) by Class::MOP::Class:::around at line 43 of Class/MOP/Class/Immutable/Trait.pm, avg 0s/call | ||||
| 902 | 1180 | 17.5ms | my $self = shift; | ||
| 903 | 295 | 1.58ms | my $name = $self->name; # spent 1.58ms making 295 calls to Class::MOP::Package::name, avg 5µs/call | ||
| 904 | |||||
| 905 | 295 | 1.58ms | unless (Class::MOP::IS_RUNNING_ON_5_10()) { # spent 1.58ms making 295 calls to Class::MOP::__ANON__, avg 5µs/call | ||
| 906 | # NOTE: | ||||
| 907 | # We need to check for circular inheritance here | ||||
| 908 | # if we are are not on 5.10, cause 5.8 detects it | ||||
| 909 | # late. This will do nothing if all is well, and | ||||
| 910 | # blow up otherwise. Yes, it's an ugly hack, better | ||||
| 911 | # suggestions are welcome. | ||||
| 912 | # - SL | ||||
| 913 | ($name || return)->isa('This is a test for circular inheritance') | ||||
| 914 | } | ||||
| 915 | |||||
| 916 | # if our mro is c3, we can | ||||
| 917 | # just grab the linear_isa | ||||
| 918 | 295 | 7.62ms | 295 | 3.60ms | if (mro::get_mro($name) eq 'c3') { # spent 3.60ms making 295 calls to mro::get_mro, avg 12µs/call |
| 919 | return @{ mro::get_linear_isa($name) } | ||||
| 920 | } | ||||
| 921 | else { | ||||
| 922 | # NOTE: | ||||
| 923 | # we can't grab the linear_isa for dfs | ||||
| 924 | # since it has all the duplicates | ||||
| 925 | # already removed. | ||||
| 926 | return ( | ||||
| 927 | 464 | 22.9ms | $name, # spent 25.6ms making 73 calls to Class::MOP::Class::Immutable::Class::MOP::Class::class_precedence_list, avg 351µs/call, recursion: max depth 4, sum of overlapping time 12.7ms
# spent 9.93ms making 232 calls to Class::MOP::Class::initialize, avg 43µs/call
# spent 72.6ms making 159 calls to Class::MOP::Class::class_precedence_list, avg 456µs/call, recursion: max depth 2, sum of overlapping time 72.6ms | ||
| 928 | map { | ||||
| 929 | 232 | 5.23ms | 295 | 71.8ms | Class::MOP::Class->initialize($_)->class_precedence_list() # spent 65.2ms making 264 calls to Moose::Meta::Class::superclasses, avg 247µs/call
# spent 4.66ms making 19 calls to Class::MOP::Class::Immutable::Class::MOP::Class::superclasses, avg 245µs/call
# spent 1.91ms making 12 calls to Class::MOP::Class::superclasses, avg 159µs/call |
| 930 | } $self->superclasses() | ||||
| 931 | ); | ||||
| 932 | } | ||||
| 933 | } | ||||
| 934 | |||||
| 935 | ## Methods | ||||
| 936 | |||||
| 937 | { | ||||
| 938 | 1 | 4µs | # spent 224ms (14.3+210) within Class::MOP::Class::__ANON__[/home/doy/perl5/perlbrew/perls/perl-5.10.1/lib/site_perl/5.10.1/x86_64-linux/Class/MOP/Class.pm:967] which was called 116 times, avg 1.93ms/call:
# 99 times (12.3ms+185ms) by Class::MOP::Class::add_around_method_modifier at line 993, avg 1.99ms/call
# 11 times (1.44ms+19.4ms) by Class::MOP::Class::add_before_method_modifier at line 973, avg 1.89ms/call
# 6 times (575µs+5.26ms) by Class::MOP::Class::add_after_method_modifier at line 983, avg 972µs/call | ||
| 939 | 696 | 7.94ms | my ($self, $method_name) = @_; | ||
| 940 | 116 | 1.45ms | my $wrapped_metaclass = $self->wrapped_method_metaclass; # spent 1.45ms making 116 calls to Class::MOP::Mixin::HasMethods::wrapped_method_metaclass, avg 12µs/call | ||
| 941 | # fetch it locally | ||||
| 942 | 116 | 29.9ms | my $method = $self->get_method($method_name); # spent 29.9ms making 116 calls to Class::MOP::Mixin::HasMethods::get_method, avg 257µs/call | ||
| 943 | # if we dont have local ... | ||||
| 944 | 310 | 5.62ms | unless ($method) { | ||
| 945 | # try to find the next method | ||||
| 946 | 97 | 87.4ms | $method = $self->find_next_method_by_name($method_name); # spent 87.4ms making 97 calls to Class::MOP::Class::find_next_method_by_name, avg 901µs/call | ||
| 947 | # die if it does not exist | ||||
| 948 | (defined $method) | ||||
| 949 | || confess "The method '$method_name' was not found in the inheritance hierarchy for " . $self->name; | ||||
| 950 | # and now make sure to wrap it | ||||
| 951 | # even if it is already wrapped | ||||
| 952 | # because we need a new sub ref | ||||
| 953 | 194 | 32.0ms | $method = $wrapped_metaclass->wrap($method, # spent 31.5ms making 97 calls to Class::MOP::Method::Wrapped::wrap, avg 324µs/call
# spent 548µs making 97 calls to Class::MOP::Package::name, avg 6µs/call | ||
| 954 | package_name => $self->name, | ||||
| 955 | name => $method_name, | ||||
| 956 | ); | ||||
| 957 | } | ||||
| 958 | else { | ||||
| 959 | # now make sure we wrap it properly | ||||
| 960 | 45 | 4.30ms | $method = $wrapped_metaclass->wrap($method, # spent 4.01ms making 13 calls to Class::MOP::Method::Wrapped::wrap, avg 308µs/call
# spent 216µs making 19 calls to UNIVERSAL::isa, avg 11µs/call
# spent 74µs making 13 calls to Class::MOP::Package::name, avg 6µs/call | ||
| 961 | package_name => $self->name, | ||||
| 962 | name => $method_name, | ||||
| 963 | ) unless $method->isa($wrapped_metaclass); | ||||
| 964 | } | ||||
| 965 | 116 | 54.7ms | $self->add_method($method_name => $method); # spent 54.7ms making 116 calls to Class::MOP::Mixin::HasMethods::add_method, avg 471µs/call | ||
| 966 | return $method; | ||||
| 967 | 1 | 14µs | }; | ||
| 968 | |||||
| 969 | # spent 22.4ms (610µs+21.8) within Class::MOP::Class::add_before_method_modifier which was called 11 times, avg 2.04ms/call:
# 11 times (610µs+21.8ms) by Moose::Meta::Role::Application::ToClass::apply_method_modifiers at line 221 of Moose/Meta/Role/Application/ToClass.pm, avg 2.04ms/call | ||||
| 970 | 44 | 740µs | my ($self, $method_name, $method_modifier) = @_; | ||
| 971 | (defined $method_name && length $method_name) | ||||
| 972 | || confess "You must pass in a method name"; | ||||
| 973 | 11 | 20.8ms | my $method = $fetch_and_prepare_method->($self, $method_name); # spent 20.8ms making 11 calls to Class::MOP::Class::__ANON__[Class/MOP/Class.pm:967], avg 1.89ms/call | ||
| 974 | 22 | 996µs | $method->add_before_modifier( # spent 832µs making 11 calls to Class::MOP::Method::Wrapped::add_before_modifier, avg 76µs/call
# spent 164µs making 11 calls to Sub::Name::subname, avg 15µs/call | ||
| 975 | subname(':before' => $method_modifier) | ||||
| 976 | ); | ||||
| 977 | } | ||||
| 978 | |||||
| 979 | # spent 6.72ms (338µs+6.39) within Class::MOP::Class::add_after_method_modifier which was called 6 times, avg 1.12ms/call:
# 6 times (338µs+6.39ms) by Moose::Meta::Role::Application::ToClass::apply_method_modifiers at line 221 of Moose/Meta/Role/Application/ToClass.pm, avg 1.12ms/call | ||||
| 980 | 24 | 411µs | my ($self, $method_name, $method_modifier) = @_; | ||
| 981 | (defined $method_name && length $method_name) | ||||
| 982 | || confess "You must pass in a method name"; | ||||
| 983 | 6 | 5.83ms | my $method = $fetch_and_prepare_method->($self, $method_name); # spent 5.83ms making 6 calls to Class::MOP::Class::__ANON__[Class/MOP/Class.pm:967], avg 972µs/call | ||
| 984 | 12 | 553µs | $method->add_after_modifier( # spent 458µs making 6 calls to Class::MOP::Method::Wrapped::add_after_modifier, avg 76µs/call
# spent 95µs making 6 calls to Sub::Name::subname, avg 16µs/call | ||
| 985 | subname(':after' => $method_modifier) | ||||
| 986 | ); | ||||
| 987 | } | ||||
| 988 | |||||
| 989 | # spent 218ms (5.28+213) within Class::MOP::Class::add_around_method_modifier which was called 99 times, avg 2.20ms/call:
# 52 times (2.83ms+110ms) by Moose::Meta::Role::Application::ToClass::apply_method_modifiers at line 221 of Moose/Meta/Role/Application/ToClass.pm, avg 2.18ms/call
# 46 times (2.40ms+101ms) by Class::MOP::MiniTrait::apply at line 21 of Class/MOP/MiniTrait.pm, avg 2.24ms/call
# once (51µs+1.83ms) by Moose::Util::add_method_modifier at line 244 of Moose/Util.pm | ||||
| 990 | 396 | 6.62ms | my ($self, $method_name, $method_modifier) = @_; | ||
| 991 | (defined $method_name && length $method_name) | ||||
| 992 | || confess "You must pass in a method name"; | ||||
| 993 | 99 | 197ms | my $method = $fetch_and_prepare_method->($self, $method_name); # spent 197ms making 99 calls to Class::MOP::Class::__ANON__[Class/MOP/Class.pm:967], avg 1.99ms/call | ||
| 994 | 198 | 15.4ms | $method->add_around_modifier( # spent 13.9ms making 99 calls to Class::MOP::Method::Wrapped::add_around_modifier, avg 140µs/call
# spent 1.50ms making 99 calls to Sub::Name::subname, avg 15µs/call | ||
| 995 | subname(':around' => $method_modifier) | ||||
| 996 | ); | ||||
| 997 | } | ||||
| 998 | |||||
| 999 | # NOTE: | ||||
| 1000 | # the methods above used to be named like this: | ||||
| 1001 | # ${pkg}::${method}:(before|after|around) | ||||
| 1002 | # but this proved problematic when using one modifier | ||||
| 1003 | # to wrap multiple methods (something which is likely | ||||
| 1004 | # to happen pretty regularly IMO). So instead of naming | ||||
| 1005 | # it like this, I have chosen to just name them purely | ||||
| 1006 | # with their modifier names, like so: | ||||
| 1007 | # :(before|after|around) | ||||
| 1008 | # The fact is that in a stack trace, it will be fairly | ||||
| 1009 | # evident from the context what method they are attached | ||||
| 1010 | # to, and so don't need the fully qualified name. | ||||
| 1011 | } | ||||
| 1012 | |||||
| 1013 | # spent 237ms (27.9+209) within Class::MOP::Class::find_method_by_name which was called 248 times, avg 957µs/call:
# 91 times (6.45ms+32.1ms) by Class::MOP::Mixin::HasMethods::_add_meta_method at line 25 of Class/MOP/Mixin/HasMethods.pm, avg 424µs/call
# 56 times (8.83ms+81.4ms) by Class::MOP::MiniTrait::apply at line 21 of Class/MOP/MiniTrait.pm, avg 1.61ms/call
# 42 times (5.96ms+43.5ms) by Moose::Meta::Method::Destructor::is_needed at line 62 of Moose/Meta/Method/Destructor.pm, avg 1.18ms/call
# 42 times (5.56ms+42.6ms) by Moose::Meta::Method::Constructor::_generate_BUILDARGS at line 146 of Moose/Meta/Method/Constructor.pm, avg 1.15ms/call
# 10 times (670µs+7.15ms) by Moose::Meta::Role::Application::ToClass::check_required_methods at line 64 of Moose/Meta/Role/Application/ToClass.pm, avg 782µs/call
# 7 times (482µs+2.61ms) by Moose::BEGIN@38 at line 14 of Moose/Meta/Attribute/Native.pm, avg 442µs/call | ||||
| 1014 | 856 | 6.69ms | my ($self, $method_name) = @_; | ||
| 1015 | (defined $method_name && length $method_name) | ||||
| 1016 | || confess "You must define a method name to find"; | ||||
| 1017 | 248 | 11.7ms | foreach my $class ($self->linearized_isa) { # spent 11.7ms making 248 calls to Class::MOP::Class::linearized_isa, avg 47µs/call | ||
| 1018 | 1222 | 18.3ms | 1222 | 198ms | my $method = Class::MOP::Class->initialize($class)->get_method($method_name); # spent 171ms making 611 calls to Class::MOP::Mixin::HasMethods::get_method, avg 279µs/call
# spent 27.1ms making 611 calls to Class::MOP::Class::initialize, avg 44µs/call |
| 1019 | return $method if defined $method; | ||||
| 1020 | } | ||||
| 1021 | return; | ||||
| 1022 | } | ||||
| 1023 | |||||
| 1024 | # spent 27.4ms (1.49+26.0) within Class::MOP::Class::get_all_methods which was called 8 times, avg 3.43ms/call:
# 8 times (1.49ms+26.0ms) by Class::MOP::MiniTrait::apply at line 18 of Class/MOP/MiniTrait.pm, avg 3.43ms/call | ||||
| 1025 | 32 | 318µs | my $self = shift; | ||
| 1026 | |||||
| 1027 | my %methods; | ||||
| 1028 | 8 | 364µs | for my $class ( reverse $self->linearized_isa ) { # spent 364µs making 8 calls to Class::MOP::Class::linearized_isa, avg 45µs/call | ||
| 1029 | 27 | 1.41ms | 9 | 354µs | my $meta = Class::MOP::Class->initialize($class); # spent 354µs making 9 calls to Class::MOP::Class::initialize, avg 39µs/call |
| 1030 | |||||
| 1031 | 65 | 25.2ms | $methods{ $_->name } = $_ for $meta->_get_local_methods; # spent 25.0ms making 9 calls to Class::MOP::Mixin::HasMethods::_get_local_methods, avg 2.77ms/call
# spent 287µs making 56 calls to Class::MOP::Method::name, avg 5µs/call | ||
| 1032 | } | ||||
| 1033 | |||||
| 1034 | return values %methods; | ||||
| 1035 | } | ||||
| 1036 | |||||
| 1037 | sub get_all_method_names { | ||||
| 1038 | my $self = shift; | ||||
| 1039 | my %uniq; | ||||
| 1040 | return grep { !$uniq{$_}++ } map { Class::MOP::Class->initialize($_)->get_method_list } $self->linearized_isa; | ||||
| 1041 | } | ||||
| 1042 | |||||
| 1043 | # spent 84.9ms (11.4+73.6) within Class::MOP::Class::find_all_methods_by_name which was called 81 times, avg 1.05ms/call:
# 42 times (6.22ms+42.0ms) by Moose::Meta::Method::Constructor::_generate_BUILDALL at line 184 of Moose/Meta/Method/Constructor.pm, avg 1.15ms/call
# 39 times (5.17ms+31.5ms) by Moose::Meta::Method::Destructor::_initialize_body at line 81 of Moose/Meta/Method/Destructor.pm, avg 941µs/call | ||||
| 1044 | 405 | 3.06ms | my ($self, $method_name) = @_; | ||
| 1045 | (defined $method_name && length $method_name) | ||||
| 1046 | || confess "You must define a method name to find"; | ||||
| 1047 | my @methods; | ||||
| 1048 | 81 | 3.56ms | foreach my $class ($self->linearized_isa) { # spent 3.56ms making 81 calls to Class::MOP::Class::linearized_isa, avg 44µs/call | ||
| 1049 | # fetch the meta-class ... | ||||
| 1050 | 506 | 6.89ms | 253 | 10.5ms | my $meta = Class::MOP::Class->initialize($class); # spent 10.5ms making 253 calls to Class::MOP::Class::initialize, avg 42µs/call |
| 1051 | 254 | 59.5ms | push @methods => { # spent 58.9ms making 253 calls to Class::MOP::Mixin::HasMethods::has_method, avg 233µs/call
# spent 563µs making 1 call to Class::MOP::Mixin::HasMethods::get_method | ||
| 1052 | name => $method_name, | ||||
| 1053 | class => $class, | ||||
| 1054 | code => $meta->get_method($method_name) | ||||
| 1055 | } if $meta->has_method($method_name); | ||||
| 1056 | } | ||||
| 1057 | return @methods; | ||||
| 1058 | } | ||||
| 1059 | |||||
| 1060 | # spent 189ms (27.4+161) within Class::MOP::Class::find_next_method_by_name which was called 253 times, avg 745µs/call:
# 111 times (11.4ms+66.1ms) by Class::MOP::Method::Inlined::can_be_inlined at line 40 of Class/MOP/Method/Inlined.pm, avg 699µs/call
# 97 times (12.0ms+75.4ms) by Class::MOP::Class::__ANON__[/home/doy/perl5/perlbrew/perls/perl-5.10.1/lib/site_perl/5.10.1/x86_64-linux/Class/MOP/Class.pm:967] at line 946, avg 901µs/call
# 45 times (4.01ms+19.7ms) by Moose::Meta::Method::Overridden::new at line 23 of Moose/Meta/Method/Overridden.pm, avg 526µs/call | ||||
| 1061 | 1270 | 8.74ms | my ($self, $method_name) = @_; | ||
| 1062 | (defined $method_name && length $method_name) | ||||
| 1063 | || confess "You must define a method name to find"; | ||||
| 1064 | 253 | 12.4ms | my @cpl = $self->linearized_isa; # spent 12.4ms making 253 calls to Class::MOP::Class::linearized_isa, avg 49µs/call | ||
| 1065 | shift @cpl; # discard ourselves | ||||
| 1066 | foreach my $class (@cpl) { | ||||
| 1067 | 948 | 15.9ms | 948 | 149ms | my $method = Class::MOP::Class->initialize($class)->get_method($method_name); # spent 128ms making 474 calls to Class::MOP::Mixin::HasMethods::get_method, avg 270µs/call
# spent 20.6ms making 474 calls to Class::MOP::Class::initialize, avg 43µs/call |
| 1068 | return $method if defined $method; | ||||
| 1069 | } | ||||
| 1070 | return; | ||||
| 1071 | } | ||||
| 1072 | |||||
| 1073 | # spent 1.28ms within Class::MOP::Class::update_meta_instance_dependencies which was called 110 times, avg 12µs/call:
# 110 times (1.28ms+0s) by Class::MOP::Class::_superclasses_updated at line 866, avg 12µs/call | ||||
| 1074 | 220 | 1.84ms | my $self = shift; | ||
| 1075 | |||||
| 1076 | if ( $self->{meta_instance_dependencies} ) { | ||||
| 1077 | return $self->add_meta_instance_dependencies; | ||||
| 1078 | } | ||||
| 1079 | } | ||||
| 1080 | |||||
| 1081 | sub add_meta_instance_dependencies { | ||||
| 1082 | my $self = shift; | ||||
| 1083 | |||||
| 1084 | $self->remove_meta_instance_dependencies; | ||||
| 1085 | |||||
| 1086 | my @attrs = $self->get_all_attributes(); | ||||
| 1087 | |||||
| 1088 | my %seen; | ||||
| 1089 | my @classes = grep { not $seen{ $_->name }++ } | ||||
| 1090 | map { $_->associated_class } @attrs; | ||||
| 1091 | |||||
| 1092 | foreach my $class (@classes) { | ||||
| 1093 | $class->add_dependent_meta_instance($self); | ||||
| 1094 | } | ||||
| 1095 | |||||
| 1096 | $self->{meta_instance_dependencies} = \@classes; | ||||
| 1097 | } | ||||
| 1098 | |||||
| 1099 | sub remove_meta_instance_dependencies { | ||||
| 1100 | my $self = shift; | ||||
| 1101 | |||||
| 1102 | if ( my $classes = delete $self->{meta_instance_dependencies} ) { | ||||
| 1103 | foreach my $class (@$classes) { | ||||
| 1104 | $class->remove_dependent_meta_instance($self); | ||||
| 1105 | } | ||||
| 1106 | |||||
| 1107 | return $classes; | ||||
| 1108 | } | ||||
| 1109 | |||||
| 1110 | return; | ||||
| 1111 | |||||
| 1112 | } | ||||
| 1113 | |||||
| 1114 | sub add_dependent_meta_instance { | ||||
| 1115 | my ( $self, $metaclass ) = @_; | ||||
| 1116 | push @{ $self->{dependent_meta_instances} }, $metaclass; | ||||
| 1117 | } | ||||
| 1118 | |||||
| 1119 | sub remove_dependent_meta_instance { | ||||
| 1120 | my ( $self, $metaclass ) = @_; | ||||
| 1121 | my $name = $metaclass->name; | ||||
| 1122 | @$_ = grep { $_->name ne $name } @$_ | ||||
| 1123 | for $self->{dependent_meta_instances}; | ||||
| 1124 | } | ||||
| 1125 | |||||
| 1126 | # spent 9.66ms (7.42+2.24) within Class::MOP::Class::invalidate_meta_instances which was called 187 times, avg 52µs/call:
# 187 times (7.42ms+2.24ms) by Class::MOP::Class::_post_add_attribute at line 784, avg 52µs/call | ||||
| 1127 | 561 | 7.17ms | my $self = shift; | ||
| 1128 | $_->invalidate_meta_instance() | ||||
| 1129 | 187 | 2.24ms | for $self, @{ $self->{dependent_meta_instances} }; # spent 2.24ms making 187 calls to Class::MOP::Class::invalidate_meta_instance, avg 12µs/call | ||
| 1130 | } | ||||
| 1131 | |||||
| 1132 | # spent 2.24ms within Class::MOP::Class::invalidate_meta_instance which was called 187 times, avg 12µs/call:
# 187 times (2.24ms+0s) by Class::MOP::Class::invalidate_meta_instances at line 1129, avg 12µs/call | ||||
| 1133 | 374 | 3.01ms | my $self = shift; | ||
| 1134 | undef $self->{_meta_instance}; | ||||
| 1135 | } | ||||
| 1136 | |||||
| 1137 | # check if we can reinitialize | ||||
| 1138 | sub is_pristine { | ||||
| 1139 | my $self = shift; | ||||
| 1140 | |||||
| 1141 | # if any local attr is defined | ||||
| 1142 | return if $self->get_attribute_list; | ||||
| 1143 | |||||
| 1144 | # or any non-declared methods | ||||
| 1145 | for my $method ( map { $self->get_method($_) } $self->get_method_list ) { | ||||
| 1146 | return if $method->isa("Class::MOP::Method::Generated"); | ||||
| 1147 | # FIXME do we need to enforce this too? return unless $method->isa( $self->method_metaclass ); | ||||
| 1148 | } | ||||
| 1149 | |||||
| 1150 | return 1; | ||||
| 1151 | } | ||||
| 1152 | |||||
| 1153 | ## Class closing | ||||
| 1154 | |||||
| 1155 | 124 | 1.41ms | # spent 896µs within Class::MOP::Class::is_mutable which was called 124 times, avg 7µs/call:
# 93 times (702µs+0s) by Class::MOP::Class::make_immutable at line 1179, avg 8µs/call
# 22 times (137µs+0s) by MooseX::Types::BEGIN@2 at line 231 of Moose.pm, avg 6µs/call
# 9 times (57µs+0s) by Moose::Meta::Attribute::BEGIN@20 at line 688 of Moose/Util/TypeConstraints.pm, avg 6µs/call | ||
| 1156 | 317 | 3.87ms | # spent 2.51ms within Class::MOP::Class::is_immutable which was called 317 times, avg 8µs/call:
# 317 times (2.51ms+0s) by Class::MOP::Class::_real_ref_name at line 126, avg 8µs/call | ||
| 1157 | |||||
| 1158 | sub immutable_options { %{ $_[0]{__immutable}{options} || {} } } | ||||
| 1159 | |||||
| 1160 | # spent 11.3ms (7.14+4.14) within Class::MOP::Class::_immutable_options which was called 93 times, avg 121µs/call:
# 51 times (3.77ms+1.94ms) by Class::MOP::Class::make_immutable at line 1180, avg 112µs/call
# 42 times (3.37ms+2.19ms) by Moose::Meta::Class::_immutable_options at line 461 of Moose/Meta/Class.pm, avg 132µs/call | ||||
| 1161 | 186 | 6.01ms | my ( $self, @args ) = @_; | ||
| 1162 | |||||
| 1163 | return ( | ||||
| 1164 | 372 | 4.14ms | inline_accessors => 1, # spent 993µs making 93 calls to Class::MOP::Class::constructor_name, avg 11µs/call
# spent 595µs making 42 calls to Moose::Meta::Class::immutable_trait, avg 14µs/call
# spent 569µs making 42 calls to Moose::Meta::Class::destructor_class, avg 14µs/call
# spent 557µs making 42 calls to Moose::Meta::Class::constructor_class, avg 13µs/call
# spent 505µs making 51 calls to Class::MOP::Class::immutable_trait, avg 10µs/call
# spent 491µs making 51 calls to Class::MOP::Class::constructor_class, avg 10µs/call
# spent 425µs making 51 calls to Class::MOP::Class::destructor_class, avg 8µs/call | ||
| 1165 | inline_constructor => 1, | ||||
| 1166 | inline_destructor => 0, | ||||
| 1167 | debug => 0, | ||||
| 1168 | immutable_trait => $self->immutable_trait, | ||||
| 1169 | constructor_name => $self->constructor_name, | ||||
| 1170 | constructor_class => $self->constructor_class, | ||||
| 1171 | destructor_class => $self->destructor_class, | ||||
| 1172 | @args, | ||||
| 1173 | ); | ||||
| 1174 | } | ||||
| 1175 | |||||
| 1176 | # spent 1.39s (7.61ms+1.38) within Class::MOP::Class::make_immutable which was called 93 times, avg 14.9ms/call:
# 22 times (1.88ms+303ms) by MooseX::Types::BEGIN@2 at line 236 of Moose.pm, avg 13.9ms/call
# 13 times (934µs+107ms) by MooseX::Types::Combine::BEGIN@12 at line 699 of Class/MOP.pm, avg 8.27ms/call
# 9 times (759µs+125ms) by Moose::Meta::Attribute::BEGIN@20 at line 693 of Moose/Util/TypeConstraints.pm, avg 14.0ms/call
# 4 times (275µs+2.58ms) by MooseX::Types::Combine::BEGIN@12 at line 724 of Class/MOP.pm, avg 713µs/call
# 2 times (166µs+-166µs) by Class::MOP::Class::_immutable_metaclass at line 1253, avg 0s/call
# once (120µs+129ms) by Markdent::Simple::Document::BEGIN@9 at line 48 of Markdent/Handler/HTMLStream/Document.pm
# once (83µs+42.9ms) by MooseX::Role::Parameterized::Meta::Role::Parameterizable::BEGIN@7 at line 8 of MooseX/Role/Parameterized/Meta/Role/Parameterized.pm
# once (81µs+38.9ms) by MooseX::Role::Parameterized::BEGIN@8 at line 130 of MooseX/Role/Parameterized/Meta/Role/Parameterizable.pm
# once (81µs+35.0ms) by MooseX::Types::BEGIN@2 at line 268 of Moose.pm
# once (87µs+32.5ms) by MooseX::Role::Parameterized::Meta::Role::Parameterizable::BEGIN@8 at line 22 of MooseX/Role/Parameterized/Meta/Parameter.pm
# once (82µs+24.6ms) by Markdent::Parser::BEGIN@10 at line 748 of Markdent/Dialect/Standard/BlockParser.pm
# once (83µs+22.4ms) by Markdent::Simple::Document::BEGIN@10 at line 198 of Markdent/Parser.pm
# once (85µs+21.2ms) by Markdent::Parser::BEGIN@11 at line 895 of Markdent/Dialect/Standard/SpanParser.pm
# once (81µs+19.1ms) by Markdent::Dialect::Standard::SpanParser::BEGIN@21 at line 47 of Markdent/Event/Image.pm
# once (86µs+18.6ms) by Markdent::Dialect::Standard::SpanParser::BEGIN@25 at line 43 of Markdent/Event/StartLink.pm
# once (81µs+16.1ms) by Markdent::Dialect::Standard::SpanParser::BEGIN@27 at line 35 of Markdent/Event/Text.pm
# once (81µs+15.8ms) by Markdent::Dialect::Standard::SpanParser::BEGIN@24 at line 29 of Markdent/Event/StartHTMLTag.pm
# once (82µs+15.8ms) by Markdent::Dialect::Standard::SpanParser::BEGIN@20 at line 29 of Markdent/Event/HTMLTag.pm
# once (83µs+15.1ms) by Markdent::Dialect::Standard::BlockParser::BEGIN@10 at line 15 of Markdent/Event/StartDocument.pm
# once (90µs+14.9ms) by Markdent::Dialect::Standard::SpanParser::BEGIN@15 at line 23 of Markdent/Event/EndHTMLTag.pm
# once (90µs+14.7ms) by Markdent::Dialect::Standard::SpanParser::BEGIN@18 at line 23 of Markdent/Event/HTMLComment.pm
# once (81µs+14.7ms) by Markdent::Dialect::Standard::SpanParser::BEGIN@17 at line 29 of Markdent/Event/EndStrong.pm
# once (81µs+14.7ms) by Markdent::Dialect::Standard::SpanParser::BEGIN@26 at line 29 of Markdent/Event/StartStrong.pm
# once (82µs+14.7ms) by Markdent::Dialect::Standard::SpanParser::BEGIN@23 at line 29 of Markdent/Event/StartEmphasis.pm
# once (81µs+14.6ms) by Markdent::Dialect::Standard::SpanParser::BEGIN@22 at line 29 of Markdent/Event/StartCode.pm
# once (84µs+14.6ms) by Markdent::Dialect::Standard::BlockParser::BEGIN@25 at line 23 of Markdent/Event/HTMLBlock.pm
# once (82µs+14.1ms) by Markdent::Dialect::Standard::BlockParser::BEGIN@14 at line 23 of Markdent/Event/StartHeader.pm
# once (84µs+14.1ms) by Markdent::Dialect::Standard::SpanParser::BEGIN@19 at line 23 of Markdent/Event/HTMLEntity.pm
# once (81µs+14.1ms) by Markdent::Dialect::Standard::SpanParser::BEGIN@14 at line 29 of Markdent/Event/EndEmphasis.pm
# once (85µs+14.0ms) by Markdent::Dialect::Standard::SpanParser::BEGIN@12 at line 23 of Markdent/Event/AutoLink.pm
# once (82µs+13.9ms) by Markdent::Dialect::Standard::SpanParser::BEGIN@13 at line 29 of Markdent/Event/EndCode.pm
# once (83µs+13.8ms) by Markdent::Dialect::Standard::BlockParser::BEGIN@15 at line 23 of Markdent/Event/EndHeader.pm
# once (84µs+13.8ms) by Markdent::Dialect::Standard::BlockParser::BEGIN@26 at line 23 of Markdent/Event/HTMLCommentBlock.pm
# once (84µs+13.8ms) by Markdent::Dialect::Standard::BlockParser::BEGIN@27 at line 23 of Markdent/Event/Preformatted.pm
# once (83µs+13.1ms) by Markdent::Dialect::Standard::SpanParser::BEGIN@16 at line 17 of Markdent/Event/EndLink.pm
# once (83µs+13.1ms) by Markdent::Dialect::Standard::BlockParser::BEGIN@20 at line 15 of Markdent/Event/StartParagraph.pm
# once (82µs+13.1ms) by Markdent::Dialect::Standard::BlockParser::BEGIN@11 at line 15 of Markdent/Event/EndDocument.pm
# once (82µs+13.0ms) by Markdent::Dialect::Standard::BlockParser::BEGIN@13 at line 15 of Markdent/Event/EndBlockquote.pm
# once (82µs+13.0ms) by Markdent::Dialect::Standard::BlockParser::BEGIN@23 at line 15 of Markdent/Event/EndUnorderedList.pm
# once (82µs+13.0ms) by Markdent::Dialect::Standard::BlockParser::BEGIN@24 at line 15 of Markdent/Event/HorizontalRule.pm
# once (81µs+13.0ms) by Markdent::Dialect::Standard::BlockParser::BEGIN@22 at line 15 of Markdent/Event/StartUnorderedList.pm
# once (82µs+13.0ms) by Markdent::Dialect::Standard::BlockParser::BEGIN@17 at line 15 of Markdent/Event/EndListItem.pm
# once (82µs+13.0ms) by Markdent::Dialect::Standard::BlockParser::BEGIN@18 at line 15 of Markdent/Event/StartOrderedList.pm
# once (83µs+13.0ms) by Markdent::Dialect::Standard::BlockParser::BEGIN@21 at line 15 of Markdent/Event/EndParagraph.pm
# once (82µs+13.0ms) by Markdent::Dialect::Standard::BlockParser::BEGIN@19 at line 15 of Markdent/Event/EndOrderedList.pm
# once (82µs+12.9ms) by Markdent::Dialect::Standard::BlockParser::BEGIN@16 at line 15 of Markdent/Event/StartListItem.pm
# once (81µs+12.9ms) by Markdent::Dialect::Standard::BlockParser::BEGIN@12 at line 15 of Markdent/Event/StartBlockquote.pm
# once (80µs+10.8ms) by MooseX::Role::Parameterized::Meta::Trait::Parameterized::BEGIN@6 at line 6 of MooseX/Role/Parameterized/Parameters.pm | ||||
| 1177 | 186 | 1.59ms | my ( $self, @args ) = @_; | ||
| 1178 | |||||
| 1179 | 279 | 5.85ms | 93 | 702µs | if ( $self->is_mutable ) { # spent 702µs making 93 calls to Class::MOP::Class::is_mutable, avg 8µs/call |
| 1180 | 186 | 1.12s | $self->_initialize_immutable( $self->_immutable_options(@args) ); # spent 1.11s making 93 calls to Class::MOP::Class::_initialize_immutable, avg 11.9ms/call
# spent 7.35ms making 42 calls to Moose::Meta::Class::_immutable_options, avg 175µs/call
# spent 5.71ms making 51 calls to Class::MOP::Class::_immutable_options, avg 112µs/call | ||
| 1181 | 93 | 256ms | $self->_rebless_as_immutable(@args); # spent 257ms making 93 calls to Class::MOP::Class::_rebless_as_immutable, avg 2.77ms/call, recursion: max depth 1, sum of overlapping time 1.09ms | ||
| 1182 | return $self; | ||||
| 1183 | } | ||||
| 1184 | else { | ||||
| 1185 | return; | ||||
| 1186 | } | ||||
| 1187 | } | ||||
| 1188 | |||||
| 1189 | sub make_mutable { | ||||
| 1190 | my $self = shift; | ||||
| 1191 | |||||
| 1192 | if ( $self->is_immutable ) { | ||||
| 1193 | my @args = $self->immutable_options; | ||||
| 1194 | $self->_rebless_as_mutable(); | ||||
| 1195 | $self->_remove_inlined_code(@args); | ||||
| 1196 | delete $self->{__immutable}; | ||||
| 1197 | return $self; | ||||
| 1198 | } | ||||
| 1199 | else { | ||||
| 1200 | return; | ||||
| 1201 | } | ||||
| 1202 | } | ||||
| 1203 | |||||
| 1204 | # spent 256ms (3.93+252) within Class::MOP::Class::_rebless_as_immutable which was called 93 times, avg 2.75ms/call:
# 93 times (3.93ms+252ms) by Class::MOP::Class::make_immutable at line 1181, avg 2.75ms/call | ||||
| 1205 | 279 | 3.75ms | my ( $self, @args ) = @_; | ||
| 1206 | |||||
| 1207 | $self->{__immutable}{original_class} = ref $self; | ||||
| 1208 | |||||
| 1209 | 93 | 252ms | bless $self => $self->_immutable_metaclass(@args); # spent 253ms making 93 calls to Class::MOP::Class::_immutable_metaclass, avg 2.72ms/call, recursion: max depth 1, sum of overlapping time 937µs | ||
| 1210 | } | ||||
| 1211 | |||||
| 1212 | # spent 252ms (9.74+243) within Class::MOP::Class::_immutable_metaclass which was called 93 times, avg 2.71ms/call:
# 93 times (9.74ms+243ms) by Class::MOP::Class::_rebless_as_immutable at line 1209, avg 2.71ms/call | ||||
| 1213 | 754 | 10.7ms | my ( $self, %args ) = @_; | ||
| 1214 | |||||
| 1215 | if ( my $class = $args{immutable_metaclass} ) { | ||||
| 1216 | return $class; | ||||
| 1217 | } | ||||
| 1218 | |||||
| 1219 | 93 | 1.13ms | my $trait = $args{immutable_trait} = $self->immutable_trait # spent 641µs making 42 calls to Moose::Meta::Class::immutable_trait, avg 15µs/call
# spent 494µs making 51 calls to Class::MOP::Class::immutable_trait, avg 10µs/call | ||
| 1220 | || confess "no immutable trait specified for $self"; | ||||
| 1221 | |||||
| 1222 | 93 | 7.66ms | my $meta = $self->meta; # spent 7.66ms making 93 calls to Class::MOP::Object::meta, avg 82µs/call | ||
| 1223 | 93 | 23.1ms | my $meta_attr = $meta->find_attribute_by_name("immutable_trait"); # spent 23.1ms making 93 calls to Class::MOP::Class::find_attribute_by_name, avg 248µs/call | ||
| 1224 | |||||
| 1225 | my $class_name; | ||||
| 1226 | |||||
| 1227 | 93 | 1.62ms | if ( $meta_attr and $trait eq $meta_attr->default ) { # spent 1.62ms making 93 calls to Class::MOP::Mixin::AttributeCore::default, avg 17µs/call | ||
| 1228 | # if the trait is the same as the default we try and pick a | ||||
| 1229 | # predictable name for the immutable metaclass | ||||
| 1230 | $class_name = 'Class::MOP::Class::Immutable::' . ref($self); | ||||
| 1231 | } | ||||
| 1232 | else { | ||||
| 1233 | $class_name = join '::', 'Class::MOP::Class::Immutable::CustomTrait', | ||||
| 1234 | $trait, 'ForMetaClass', ref($self); | ||||
| 1235 | } | ||||
| 1236 | |||||
| 1237 | 93 | 1.71ms | return $class_name # spent 1.71ms making 93 calls to Class::MOP::is_class_loaded, avg 18µs/call | ||
| 1238 | if Class::MOP::is_class_loaded($class_name); | ||||
| 1239 | |||||
| 1240 | # If the metaclass is a subclass of CMOP::Class which has had | ||||
| 1241 | # metaclass roles applied (via Moose), then we want to make sure | ||||
| 1242 | # that we preserve that anonymous class (see Fey::ORM for an | ||||
| 1243 | # example of where this matters). | ||||
| 1244 | 2 | 129µs | my $meta_name = $meta->_real_ref_name; # spent 129µs making 2 calls to Class::MOP::Class::_real_ref_name, avg 64µs/call | ||
| 1245 | |||||
| 1246 | 2 | 12.0ms | my $immutable_meta = $meta_name->create( # spent 12.0ms making 2 calls to Class::MOP::Class::create, avg 5.98ms/call | ||
| 1247 | $class_name, | ||||
| 1248 | superclasses => [ ref $self ], | ||||
| 1249 | ); | ||||
| 1250 | |||||
| 1251 | 2 | 195ms | Class::MOP::MiniTrait::apply( $immutable_meta, $trait ); # spent 195ms making 2 calls to Class::MOP::MiniTrait::apply, avg 97.3ms/call | ||
| 1252 | |||||
| 1253 | 2 | 0s | $immutable_meta->make_immutable( # spent 1.68ms making 2 calls to Class::MOP::Class::make_immutable, avg 838µs/call, recursion: max depth 1, sum of overlapping time 1.68ms | ||
| 1254 | inline_constructor => 0, | ||||
| 1255 | inline_accessors => 0, | ||||
| 1256 | ); | ||||
| 1257 | |||||
| 1258 | return $class_name; | ||||
| 1259 | } | ||||
| 1260 | |||||
| 1261 | sub _remove_inlined_code { | ||||
| 1262 | my $self = shift; | ||||
| 1263 | |||||
| 1264 | $self->remove_method( $_->name ) for $self->_inlined_methods; | ||||
| 1265 | |||||
| 1266 | delete $self->{__immutable}{inlined_methods}; | ||||
| 1267 | } | ||||
| 1268 | |||||
| 1269 | sub _inlined_methods { @{ $_[0]{__immutable}{inlined_methods} || [] } } | ||||
| 1270 | |||||
| 1271 | sub _add_inlined_method { | ||||
| 1272 | 224 | 2.45ms | my ( $self, $method ) = @_; | ||
| 1273 | |||||
| 1274 | push @{ $self->{__immutable}{inlined_methods} ||= [] }, $method; | ||||
| 1275 | } | ||||
| 1276 | |||||
| 1277 | # spent 1.11s (5.33ms+1.10) within Class::MOP::Class::_initialize_immutable which was called 93 times, avg 11.9ms/call:
# 93 times (5.33ms+1.10s) by Class::MOP::Class::make_immutable at line 1180, avg 11.9ms/call | ||||
| 1278 | 279 | 4.99ms | my ( $self, %args ) = @_; | ||
| 1279 | |||||
| 1280 | $self->{__immutable}{options} = \%args; | ||||
| 1281 | 93 | 1.10s | $self->_install_inlined_code(%args); # spent 1.10s making 93 calls to Class::MOP::Class::_install_inlined_code, avg 11.9ms/call | ||
| 1282 | } | ||||
| 1283 | |||||
| 1284 | # spent 1.10s (5.70ms+1.10) within Class::MOP::Class::_install_inlined_code which was called 93 times, avg 11.9ms/call:
# 93 times (5.70ms+1.10s) by Class::MOP::Class::_initialize_immutable at line 1281, avg 11.9ms/call | ||||
| 1285 | 372 | 5.72ms | my ( $self, %args ) = @_; | ||
| 1286 | |||||
| 1287 | # FIXME | ||||
| 1288 | 32 | 187ms | $self->_inline_accessors(%args) if $args{inline_accessors}; # spent 187ms making 32 calls to Class::MOP::Class::_inline_accessors, avg 5.86ms/call | ||
| 1289 | 73 | 712ms | $self->_inline_constructor(%args) if $args{inline_constructor}; # spent 712ms making 73 calls to Class::MOP::Class::_inline_constructor, avg 9.75ms/call | ||
| 1290 | 42 | 199ms | $self->_inline_destructor(%args) if $args{inline_destructor}; # spent 199ms making 42 calls to Class::MOP::Class::_inline_destructor, avg 4.73ms/call | ||
| 1291 | } | ||||
| 1292 | |||||
| 1293 | sub _rebless_as_mutable { | ||||
| 1294 | my $self = shift; | ||||
| 1295 | |||||
| 1296 | bless $self, $self->_get_mutable_metaclass_name; | ||||
| 1297 | |||||
| 1298 | return $self; | ||||
| 1299 | } | ||||
| 1300 | |||||
| 1301 | # spent 187ms (3.15+184) within Class::MOP::Class::_inline_accessors which was called 32 times, avg 5.86ms/call:
# 32 times (3.15ms+184ms) by Class::MOP::Class::_install_inlined_code at line 1288, avg 5.86ms/call | ||||
| 1302 | 64 | 919µs | my $self = shift; | ||
| 1303 | |||||
| 1304 | 32 | 1.15ms | foreach my $attr_name ( $self->get_attribute_list ) { # spent 1.15ms making 32 calls to Class::MOP::Mixin::HasAttributes::get_attribute_list, avg 36µs/call | ||
| 1305 | 68 | 1.76ms | 136 | 183ms | $self->get_attribute($attr_name)->install_accessors(1); # spent 174ms making 67 calls to Class::MOP::Attribute::install_accessors, avg 2.59ms/call
# spent 6.67ms making 1 call to Moose::Meta::Attribute::install_accessors
# spent 2.71ms making 68 calls to Class::MOP::Mixin::HasAttributes::get_attribute, avg 40µs/call |
| 1306 | } | ||||
| 1307 | } | ||||
| 1308 | |||||
| 1309 | # spent 712ms (10.9+701) within Class::MOP::Class::_inline_constructor which was called 73 times, avg 9.75ms/call:
# 73 times (10.9ms+701ms) by Class::MOP::Class::_install_inlined_code at line 1289, avg 9.75ms/call | ||||
| 1310 | 584 | 8.52ms | my ( $self, %args ) = @_; | ||
| 1311 | |||||
| 1312 | my $name = $args{constructor_name}; | ||||
| 1313 | # A class may not even have a constructor, and that's okay. | ||||
| 1314 | return unless defined $name; | ||||
| 1315 | |||||
| 1316 | 73 | 22.8ms | if ( $self->has_method($name) && !$args{replace_constructor} ) { # spent 22.8ms making 73 calls to Class::MOP::Mixin::HasMethods::has_method, avg 313µs/call | ||
| 1317 | my $class = $self->name; | ||||
| 1318 | warn "Not inlining a constructor for $class since it defines" | ||||
| 1319 | . " its own constructor.\n" | ||||
| 1320 | . "If you are certain you don't need to inline your" | ||||
| 1321 | . " constructor, specify inline_constructor => 0 in your" | ||||
| 1322 | . " call to $class->meta->make_immutable\n"; | ||||
| 1323 | return; | ||||
| 1324 | } | ||||
| 1325 | |||||
| 1326 | my $constructor_class = $args{constructor_class}; | ||||
| 1327 | |||||
| 1328 | 73 | 9.60ms | Class::MOP::load_class($constructor_class); # spent 18.2ms making 73 calls to Class::MOP::load_class, avg 250µs/call, recursion: max depth 2, sum of overlapping time 8.64ms | ||
| 1329 | |||||
| 1330 | 146 | 555ms | my $constructor = $constructor_class->new( # spent 363ms making 42 calls to Moose::Meta::Method::Constructor::new, avg 8.65ms/call
# spent 192ms making 31 calls to Class::MOP::Method::Constructor::new, avg 6.18ms/call
# spent 498µs making 73 calls to Class::MOP::Package::name, avg 7µs/call | ||
| 1331 | options => \%args, | ||||
| 1332 | metaclass => $self, | ||||
| 1333 | is_inline => 1, | ||||
| 1334 | package_name => $self->name, | ||||
| 1335 | name => $name, | ||||
| 1336 | ); | ||||
| 1337 | |||||
| 1338 | 146 | 2.15ms | 72 | 67.9ms | if ( $args{replace_constructor} or $constructor->can_be_inlined ) { # spent 67.9ms making 72 calls to Class::MOP::Method::Inlined::can_be_inlined, avg 943µs/call |
| 1339 | 73 | 35.3ms | $self->add_method( $name => $constructor ); # spent 35.3ms making 73 calls to Class::MOP::Mixin::HasMethods::add_method, avg 483µs/call | ||
| 1340 | 73 | 1.55ms | $self->_add_inlined_method($constructor); # spent 1.55ms making 73 calls to Class::MOP::Class::_add_inlined_method, avg 21µs/call | ||
| 1341 | } | ||||
| 1342 | } | ||||
| 1343 | |||||
| 1344 | # spent 199ms (6.82+192) within Class::MOP::Class::_inline_destructor which was called 42 times, avg 4.73ms/call:
# 42 times (6.82ms+192ms) by Class::MOP::Class::_install_inlined_code at line 1290, avg 4.73ms/call | ||||
| 1345 | 330 | 5.28ms | my ( $self, %args ) = @_; | ||
| 1346 | |||||
| 1347 | ( exists $args{destructor_class} && defined $args{destructor_class} ) | ||||
| 1348 | || confess "The 'inline_destructor' option is present, but " | ||||
| 1349 | . "no destructor class was specified"; | ||||
| 1350 | |||||
| 1351 | 42 | 12.2ms | if ( $self->has_method('DESTROY') && ! $args{replace_destructor} ) { # spent 12.2ms making 42 calls to Class::MOP::Mixin::HasMethods::has_method, avg 292µs/call | ||
| 1352 | my $class = $self->name; | ||||
| 1353 | warn "Not inlining a destructor for $class since it defines" | ||||
| 1354 | . " its own destructor.\n"; | ||||
| 1355 | return; | ||||
| 1356 | } | ||||
| 1357 | |||||
| 1358 | my $destructor_class = $args{destructor_class}; | ||||
| 1359 | |||||
| 1360 | 42 | 9.59ms | Class::MOP::load_class($destructor_class); # spent 10.6ms making 42 calls to Class::MOP::load_class, avg 252µs/call, recursion: max depth 2, sum of overlapping time 972µs | ||
| 1361 | |||||
| 1362 | 42 | 52.4ms | return unless $destructor_class->is_needed($self); # spent 52.4ms making 42 calls to Moose::Meta::Method::Destructor::is_needed, avg 1.25ms/call | ||
| 1363 | |||||
| 1364 | 78 | 65.4ms | my $destructor = $destructor_class->new( # spent 65.1ms making 39 calls to Moose::Meta::Method::Destructor::new, avg 1.67ms/call
# spent 234µs making 39 calls to Class::MOP::Package::name, avg 6µs/call | ||
| 1365 | options => \%args, | ||||
| 1366 | metaclass => $self, | ||||
| 1367 | package_name => $self->name, | ||||
| 1368 | name => 'DESTROY' | ||||
| 1369 | ); | ||||
| 1370 | |||||
| 1371 | 78 | 1.12ms | 39 | 32.5ms | if ( $args{replace_destructor} or $destructor->can_be_inlined ) { # spent 32.5ms making 39 calls to Class::MOP::Method::Inlined::can_be_inlined, avg 834µs/call |
| 1372 | 39 | 17.9ms | $self->add_method( 'DESTROY' => $destructor ); # spent 17.9ms making 39 calls to Class::MOP::Mixin::HasMethods::add_method, avg 459µs/call | ||
| 1373 | 39 | 708µs | $self->_add_inlined_method($destructor); # spent 708µs making 39 calls to Class::MOP::Class::_add_inlined_method, avg 18µs/call | ||
| 1374 | } | ||||
| 1375 | } | ||||
| 1376 | |||||
| 1377 | 1 | 23µs | 1; | ||
| 1378 | |||||
| 1379 | __END__ | ||||
sub Class::MOP::Class::CORE:match; # opcode | |||||
sub Class::MOP::Class::CORE:regcomp; # opcode |