Profile of Moose/Meta/Class/Immutable/Trait.pm

← Index
NYTProf Performance Profile «line view»
For script/ponapi
Run on Wed Feb 10 15:51:26 2016
Reported on Thu Feb 11 09:43:10 2016

Filename | /usr/local/lib/perl/5.18.2/Moose/Meta/Class/Immutable/Trait.pm
Statements | Executed 8616576 statements in 12.4s

Subroutines
Calls | P | F | Exclusive Time | Inclusive Time | Subroutine
--- | --- | --- | --- | --- | ---
1 | 1 | 1 | 26µs | 70µs | Moose::Meta::Class::Immutable::Trait::::BEGIN@8Moose::Meta::Class::Immutable::Trait::BEGIN@8
1 | 1 | 1 | 10µs | 19µs | Moose::Meta::Class::Immutable::Trait::::BEGIN@4Moose::Meta::Class::Immutable::Trait::BEGIN@4
1 | 1 | 1 | 8µs | 10µs | Moose::Meta::Class::Immutable::Trait::::BEGIN@5Moose::Meta::Class::Immutable::Trait::BEGIN@5
1 | 1 | 1 | 6µs | 107µs | Moose::Meta::Class::Immutable::Trait::::BEGIN@12Moose::Meta::Class::Immutable::Trait::BEGIN@12
1 | 1 | 1 | 6µs | 25µs | Moose::Meta::Class::Immutable::Trait::::BEGIN@10Moose::Meta::Class::Immutable::Trait::BEGIN@10
1 | 1 | 1 | 5µs | 5µs | Moose::Meta::Class::Immutable::Trait::::BEGIN@7Moose::Meta::Class::Immutable::Trait::BEGIN@7
0 | 0 | 0 | 0s | 0s | Moose::Meta::Class::Immutable::Trait::::add_roleMoose::Meta::Class::Immutable::Trait::add_role
0 | 0 | 0 | 0s | 0s | Moose::Meta::Class::Immutable::Trait::::calculate_all_rolesMoose::Meta::Class::Immutable::Trait::calculate_all_roles
0 | 0 | 0 | 0s | 0s | Moose::Meta::Class::Immutable::Trait::::calculate_all_roles_with_inheritanceMoose::Meta::Class::Immutable::Trait::calculate_all_roles_with_inheritance
0 | 0 | 0 | 0s | 0s | Moose::Meta::Class::Immutable::Trait::::does_roleMoose::Meta::Class::Immutable::Trait::does_role

Call graph for these subroutines as a Graphviz dot language file.

Line | State ments | Time on line | Calls | Time in subs | Code
--- | --- | --- | --- | --- | ---
1 |  |  |  |  | package Moose::Meta::Class::Immutable::Trait;
2 | 1 | 400ns |  |  | our $VERSION = '2.1604';
3 |  |  |  |  |
4 | 2 | 20µs | 2 | 28µs | # spent 19µs (10+9) within Moose::Meta::Class::Immutable::Trait::BEGIN@4 which was called: # once (10µs+9µs) by Moose::Meta::Class::BEGIN@15 at line 4 use strict; # spent 19µs making 1 call to Moose::Meta::Class::Immutable::Trait::BEGIN@4 # spent 9µs making 1 call to strict::import
5 | 2 | 17µs | 2 | 13µs | # spent 10µs (8+3) within Moose::Meta::Class::Immutable::Trait::BEGIN@5 which was called: # once (8µs+3µs) by Moose::Meta::Class::BEGIN@15 at line 5 use warnings; # spent 10µs making 1 call to Moose::Meta::Class::Immutable::Trait::BEGIN@5 # spent 3µs making 1 call to warnings::import
6 |  |  |  |  |
7 | 2 | 21µs | 1 | 5µs | # spent 5µs within Moose::Meta::Class::Immutable::Trait::BEGIN@7 which was called: # once (5µs+0s) by Moose::Meta::Class::BEGIN@15 at line 7 use Class::MOP; # spent 5µs making 1 call to Moose::Meta::Class::Immutable::Trait::BEGIN@7
8 | 2 | 57µs | 2 | 114µs | # spent 70µs (26+44) within Moose::Meta::Class::Immutable::Trait::BEGIN@8 which was called: # once (26µs+44µs) by Moose::Meta::Class::BEGIN@15 at line 8 use Scalar::Util qw( blessed ); # spent 70µs making 1 call to Moose::Meta::Class::Immutable::Trait::BEGIN@8 # spent 44µs making 1 call to Exporter::import
9 |  |  |  |  |
10 | 2 | 21µs | 2 | 45µs | # spent 25µs (6+20) within Moose::Meta::Class::Immutable::Trait::BEGIN@10 which was called: # once (6µs+20µs) by Moose::Meta::Class::BEGIN@15 at line 10 use parent 'Class::MOP::Class::Immutable::Trait'; # spent 25µs making 1 call to Moose::Meta::Class::Immutable::Trait::BEGIN@10 # spent 20µs making 1 call to parent::import
11 |  |  |  |  |
12 | 2 | 160µs | 2 | 208µs | # spent 107µs (6+101) within Moose::Meta::Class::Immutable::Trait::BEGIN@12 which was called: # once (6µs+101µs) by Moose::Meta::Class::BEGIN@15 at line 12 use Moose::Util 'throw_exception'; # spent 107µs making 1 call to Moose::Meta::Class::Immutable::Trait::BEGIN@12 # spent 101µs making 1 call to Sub::Exporter::__ANON__[Sub/Exporter.pm:337]
13 |  |  |  |  |
14 |  |  |  |  | sub add_role { $_[1]->_immutable_cannot_call }
15 |  |  |  |  |
16 |  |  |  |  | sub calculate_all_roles {
17 | 4 | 2µs |  |  | my $orig = shift;
18 | 4 | 2µs |  |  | my $self = shift;
19 | 4 | 29µs | 4 | 340µs | @{ $self->{__immutable}{calculate_all_roles} ||= [ $self->$orig ] }; # spent 340µs making 4 calls to Moose::Meta::Class::calculate_all_roles, avg 85µs/call
20 |  |  |  |  | }
21 |  |  |  |  |
22 |  |  |  |  | sub calculate_all_roles_with_inheritance {
23 | 4 | 1µs |  |  | my $orig = shift;
24 | 4 | 1µs |  |  | my $self = shift;
25 | 4 | 53µs | 4 | 1.01ms | @{ $self->{__immutable}{calculate_all_roles_with_inheritance} ||= [ $self->$orig ] }; # spent 1.01ms making 4 calls to Moose::Meta::Class::calculate_all_roles_with_inheritance, avg 253µs/call
26 |  |  |  |  | }
27 |  |  |  |  |
28 |  |  |  |  | sub does_role {
29 | 1230932 | 158ms |  |  | shift;
30 | 1230932 | 208ms |  |  | my $self = shift;
31 | 1230932 | 343ms |  |  | my $role = shift;
32 |  |  |  |  |
33 | 1230932 | 254ms |  |  | (defined $role)
34 |  |  |  |  | || throw_exception( RoleNameRequired => class_name => $self->name );
35 |  |  |  |  |
36 | 1230946 | 1.33s | 18 | 1.17ms | $self->{__immutable}{does_role} ||= { map { $_->name => 1 } $self->calculate_all_roles_with_inheritance }; # spent 1.16ms making 4 calls to Class::MOP::Class::Immutable::Moose::Meta::Class::calculate_all_roles_with_inheritance, avg 290µs/call # spent 4µs making 11 calls to Class::MOP::Package::name, avg 382ns/call # spent 4µs making 3 calls to Moose::Meta::Role::Composite::name, avg 1µs/call
37 |  |  |  |  |
38 | 1230932 | 4.75s | 1230932 | 592ms | my $name = blessed $role ? $role->name : $role; # spent 592ms making 1230932 calls to Scalar::Util::blessed, avg 481ns/call
39 |  |  |  |  |
40 | 1230932 | 5.35s |  |  | return $self->{__immutable}{does_role}{$name};
41 |  |  |  |  | }
42 |  |  |  |  |
43 | 1 | 2µs |  |  | 1;
44 |  |  |  |  |
45 |  |  |  |  | # ABSTRACT: Implements immutability for metaclass objects
46 |  |  |  |  |
47 |  |  |  |  | __END__