← Index
NYTProf Performance Profile   « block view • line view • sub view »
For bin/pan_genome_post_analysis
  Run on Fri Mar 27 11:43:32 2015
Reported on Fri Mar 27 11:45:26 2015

Filename/Users/ap13/perl5/lib/perl5/darwin-2level/Class/MOP/Class/Immutable/Trait.pm
StatementsExecuted 3922 statements in 6.06ms
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
231161µs61µsClass::MOP::Class::Immutable::Trait::::_get_mutable_metaclass_nameClass::MOP::Class::Immutable::Trait::_get_mutable_metaclass_name
11124µs48µsClass::MOP::Class::Immutable::Trait::::BEGIN@4Class::MOP::Class::Immutable::Trait::BEGIN@4
11120µs44µsClass::MOP::Class::Immutable::Trait::::BEGIN@8Class::MOP::Class::Immutable::Trait::BEGIN@8
11113µs21µsClass::MOP::Class::Immutable::Trait::::BEGIN@5Class::MOP::Class::Immutable::Trait::BEGIN@5
11113µs27µsClass::MOP::Class::Immutable::Trait::::BEGIN@39Class::MOP::Class::Immutable::Trait::BEGIN@39
11112µs29µsClass::MOP::Class::Immutable::Trait::::BEGIN@29Class::MOP::Class::Immutable::Trait::BEGIN@29
1119µs9µsClass::MOP::Class::Immutable::Trait::::BEGIN@7Class::MOP::Class::Immutable::Trait::BEGIN@7
0000s0sClass::MOP::Class::Immutable::Trait::::__ANON__[:35]Class::MOP::Class::Immutable::Trait::__ANON__[:35]
0000s0sClass::MOP::Class::Immutable::Trait::::__ANON__[:40]Class::MOP::Class::Immutable::Trait::__ANON__[:40]
0000s0sClass::MOP::Class::Immutable::Trait::::__throw_exceptionClass::MOP::Class::Immutable::Trait::__throw_exception
0000s0sClass::MOP::Class::Immutable::Trait::::_immutable_cannot_callClass::MOP::Class::Immutable::Trait::_immutable_cannot_call
0000s0sClass::MOP::Class::Immutable::Trait::::_immutable_metaclassClass::MOP::Class::Immutable::Trait::_immutable_metaclass
0000s0sClass::MOP::Class::Immutable::Trait::::_immutable_read_onlyClass::MOP::Class::Immutable::Trait::_immutable_read_only
0000s0sClass::MOP::Class::Immutable::Trait::::_method_mapClass::MOP::Class::Immutable::Trait::_method_map
0000s0sClass::MOP::Class::Immutable::Trait::::class_precedence_listClass::MOP::Class::Immutable::Trait::class_precedence_list
0000s0sClass::MOP::Class::Immutable::Trait::::get_all_attributesClass::MOP::Class::Immutable::Trait::get_all_attributes
0000s0sClass::MOP::Class::Immutable::Trait::::get_all_method_namesClass::MOP::Class::Immutable::Trait::get_all_method_names
0000s0sClass::MOP::Class::Immutable::Trait::::get_all_methodsClass::MOP::Class::Immutable::Trait::get_all_methods
0000s0sClass::MOP::Class::Immutable::Trait::::get_meta_instanceClass::MOP::Class::Immutable::Trait::get_meta_instance
0000s0sClass::MOP::Class::Immutable::Trait::::is_immutableClass::MOP::Class::Immutable::Trait::is_immutable
0000s0sClass::MOP::Class::Immutable::Trait::::is_mutableClass::MOP::Class::Immutable::Trait::is_mutable
0000s0sClass::MOP::Class::Immutable::Trait::::linearized_isaClass::MOP::Class::Immutable::Trait::linearized_isa
Call graph for these subroutines as a Graphviz dot language file.
Line State
ments
Time
on line
Calls Time
in subs
Code
1package Class::MOP::Class::Immutable::Trait;
211µsour $VERSION = '2.1403';
3
4242µs272µs
# spent 48µs (24+24) within Class::MOP::Class::Immutable::Trait::BEGIN@4 which was called: # once (24µs+24µs) by Module::Runtime::require_module at line 4
use strict;
# spent 48µs making 1 call to Class::MOP::Class::Immutable::Trait::BEGIN@4 # spent 24µs making 1 call to strict::import
5237µs230µs
# spent 21µs (13+8) within Class::MOP::Class::Immutable::Trait::BEGIN@5 which was called: # once (13µs+8µs) by Module::Runtime::require_module at line 5
use warnings;
# spent 21µs making 1 call to Class::MOP::Class::Immutable::Trait::BEGIN@5 # spent 8µs making 1 call to warnings::import
6
7244µs19µs
# spent 9µs within Class::MOP::Class::Immutable::Trait::BEGIN@7 which was called: # once (9µs+0s) by Module::Runtime::require_module at line 7
use MRO::Compat;
# spent 9µs making 1 call to Class::MOP::Class::Immutable::Trait::BEGIN@7
82236µs268µs
# spent 44µs (20+24) within Class::MOP::Class::Immutable::Trait::BEGIN@8 which was called: # once (20µs+24µs) by Module::Runtime::require_module at line 8
use Module::Runtime 'use_module';
# spent 44µs making 1 call to Class::MOP::Class::Immutable::Trait::BEGIN@8 # spent 24µs making 1 call to Module::Runtime::import
9
10# the original class of the metaclass instance
112377µs
# spent 61µs within Class::MOP::Class::Immutable::Trait::_get_mutable_metaclass_name which was called 23 times, avg 3µs/call: # 23 times (61µs+0s) by Class::MOP::Class::_real_ref_name at line 122 of Class/MOP/Class.pm, avg 3µs/call
sub _get_mutable_metaclass_name { $_[0]{__immutable}{original_class} }
12
13sub is_mutable { 0 }
142354µssub is_immutable { 1 }
15
16sub _immutable_metaclass { ref $_[1] }
17
18sub _immutable_read_only {
19 my $name = shift;
20 __throw_exception( CallingReadOnlyMethodOnAnImmutableInstance => method_name => $name );
21}
22
23sub _immutable_cannot_call {
24 my $name = shift;
25 __throw_exception( CallingMethodOnAnImmutableInstance => method_name => $name );
26}
27
2811µsfor my $name (qw/superclasses/) {
292150µs245µs
# spent 29µs (12+17) within Class::MOP::Class::Immutable::Trait::BEGIN@29 which was called: # once (12µs+17µs) by Module::Runtime::require_module at line 29
no strict 'refs';
# spent 29µs making 1 call to Class::MOP::Class::Immutable::Trait::BEGIN@29 # spent 17µs making 1 call to strict::unimport
30 *{__PACKAGE__."::$name"} = sub {
31 my $orig = shift;
32 my $self = shift;
33 _immutable_read_only($name) if @_;
34 $self->$orig;
35110µs };
36}
37
381700nsfor my $name (qw/add_method alias_method remove_method add_attribute remove_attribute remove_package_symbol add_package_symbol/) {
392493µs241µs
# spent 27µs (13+14) within Class::MOP::Class::Immutable::Trait::BEGIN@39 which was called: # once (13µs+14µs) by Module::Runtime::require_module at line 39
no strict 'refs';
# spent 27µs making 1 call to Class::MOP::Class::Immutable::Trait::BEGIN@39 # spent 14µs making 1 call to strict::unimport
40734µs *{__PACKAGE__."::$name"} = sub { _immutable_cannot_call($name) };
41}
42
43sub class_precedence_list {
44 my $orig = shift;
45 my $self = shift;
46 @{ $self->{__immutable}{class_precedence_list}
47 ||= [ $self->$orig ] };
48}
49
50sub linearized_isa {
51246431µs my $orig = shift;
52 my $self = shift;
5316161µs @{ $self->{__immutable}{linearized_isa} ||= [ $self->$orig ] };
# spent 161µs making 16 calls to Class::MOP::Class::linearized_isa, avg 10µs/call
54}
55
56sub get_all_methods {
57 my $orig = shift;
58 my $self = shift;
59 @{ $self->{__immutable}{get_all_methods} ||= [ $self->$orig ] };
60}
61
62sub get_all_method_names {
63 my $orig = shift;
64 my $self = shift;
65 @{ $self->{__immutable}{get_all_method_names} ||= [ $self->$orig ] };
66}
67
68sub get_all_attributes {
6913291.99ms my $orig = shift;
70 my $self = shift;
71161.46ms @{ $self->{__immutable}{get_all_attributes} ||= [ $self->$orig ] };
# spent 1.46ms making 16 calls to Class::MOP::Class::get_all_attributes, avg 91µs/call
72}
73
74sub get_meta_instance {
7515391.57ms my $orig = shift;
76 my $self = shift;
77222.31ms $self->{__immutable}{get_meta_instance} ||= $self->$orig;
# spent 2.31ms making 22 calls to Class::MOP::Class::get_meta_instance, avg 105µs/call
78}
79
80sub _method_map {
81738861µs my $orig = shift;
82 my $self = shift;
832499µs $self->{__immutable}{_method_map} ||= $self->$orig;
# spent 96µs making 19 calls to Class::MOP::Mixin::HasMethods::_method_map, avg 5µs/call # spent 3µs making 5 calls to Class::MOP::Method::body, avg 600ns/call
84}
85
86# private method, for this file only -
87# if we declare a method here, it will behave differently depending on what
88# class this trait is applied to, so we won't have a reliable parameter list.
89sub __throw_exception {
90 my ($exception_type, @args_to_exception) = @_;
91 die use_module( "Moose::Exception::$exception_type" )->new( @args_to_exception );
92}
93
94117µs1;
95
96# ABSTRACT: Implements immutability for metaclass objects
97
98__END__