← Index
NYTProf Performance Profile   « line view »
For /home/ss5/perl5/perlbrew/perls/perl-5.22.0/bin/benchmarkanything-storage
  Run on Mon Jan 29 16:55:34 2018
Reported on Mon Jan 29 16:57:06 2018

Filename/home/ss5/perl5/perlbrew/perls/perl-5.22.0/lib/site_perl/5.22.0/x86_64-linux/Class/MOP/Mixin/AttributeCore.pm
StatementsExecuted 3804 statements in 3.53ms
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
37443289µs337µsClass::MOP::Mixin::AttributeCore::::defaultClass::MOP::Mixin::AttributeCore::default
16244188µs188µsClass::MOP::Mixin::AttributeCore::::is_default_a_coderefClass::MOP::Mixin::AttributeCore::is_default_a_coderef
111171µs443µsClass::MOP::Mixin::AttributeCore::::BEGIN@9Class::MOP::Mixin::AttributeCore::BEGIN@9
11110µs12µsClass::MOP::Mixin::AttributeCore::::BEGIN@4Class::MOP::Mixin::AttributeCore::BEGIN@4
2117µs9µsClass::MOP::Mixin::AttributeCore::::has_read_methodClass::MOP::Mixin::AttributeCore::has_read_method
1115µs20µsClass::MOP::Mixin::AttributeCore::::BEGIN@7Class::MOP::Mixin::AttributeCore::BEGIN@7
1115µs11µsClass::MOP::Mixin::AttributeCore::::BEGIN@5Class::MOP::Mixin::AttributeCore::BEGIN@5
0000s0sClass::MOP::Mixin::AttributeCore::::has_write_methodClass::MOP::Mixin::AttributeCore::has_write_method
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::Mixin::AttributeCore;
21200nsour $VERSION = '2.1605';
3
4215µs215µs
# spent 12µs (10+3) within Class::MOP::Mixin::AttributeCore::BEGIN@4 which was called: # once (10µs+3µs) by Class::MOP::BEGIN@14 at line 4
use strict;
# spent 12µs making 1 call to Class::MOP::Mixin::AttributeCore::BEGIN@4 # spent 3µs making 1 call to strict::import
5220µs218µs
# spent 11µs (5+6) within Class::MOP::Mixin::AttributeCore::BEGIN@5 which was called: # once (5µs+6µs) by Class::MOP::BEGIN@14 at line 5
use warnings;
# spent 11µs making 1 call to Class::MOP::Mixin::AttributeCore::BEGIN@5 # spent 6µs making 1 call to warnings::import
6
7216µs235µs
# spent 20µs (5+15) within Class::MOP::Mixin::AttributeCore::BEGIN@7 which was called: # once (5µs+15µs) by Class::MOP::BEGIN@14 at line 7
use Scalar::Util 'blessed';
# spent 20µs making 1 call to Class::MOP::Mixin::AttributeCore::BEGIN@7 # spent 15µs making 1 call to Exporter::import
8
92259µs2664µs
# spent 443µs (171+272) within Class::MOP::Mixin::AttributeCore::BEGIN@9 which was called: # once (171µs+272µs) by Class::MOP::BEGIN@14 at line 9
use parent 'Class::MOP::Mixin';
# spent 443µs making 1 call to Class::MOP::Mixin::AttributeCore::BEGIN@9 # spent 222µs making 1 call to parent::import
10
11213280µssub has_accessor { defined $_[0]->{'accessor'} }
12213269µssub has_reader { defined $_[0]->{'reader'} }
13211248µssub has_writer { defined $_[0]->{'writer'} }
14211229µssub has_predicate { defined $_[0]->{'predicate'} }
15211247µssub has_clearer { defined $_[0]->{'clearer'} }
16185174µssub has_builder { defined $_[0]->{'builder'} }
17sub has_init_arg { defined $_[0]->{'init_arg'} }
18294283µssub has_default { exists $_[0]->{'default'} }
19572608µssub has_initializer { defined $_[0]->{'initializer'} }
20sub has_insertion_order { defined $_[0]->{'insertion_order'} }
21
22135151µssub _set_insertion_order { $_[0]->{'insertion_order'} = $_[1] }
23
2426µs42µs
# spent 9µs (7+2) within Class::MOP::Mixin::AttributeCore::has_read_method which was called 2 times, avg 5µs/call: # 2 times (7µs+2µs) by Moose::Meta::Method::Delegation::_get_delegate_accessor at line 127 of Moose/Meta/Method/Delegation.pm, avg 5µs/call
sub has_read_method { $_[0]->has_reader || $_[0]->has_accessor }
# spent 1µs making 2 calls to Class::MOP::Mixin::AttributeCore::has_accessor, avg 650ns/call # spent 1µs making 2 calls to Class::MOP::Mixin::AttributeCore::has_reader, avg 550ns/call
25sub has_write_method { $_[0]->has_writer || $_[0]->has_accessor }
26
27
# spent 188µs within Class::MOP::Mixin::AttributeCore::is_default_a_coderef which was called 162 times, avg 1µs/call: # 101 times (101µs+0s) by Class::MOP::Class::_inline_default_value at line 668 of Class/MOP/Class.pm, avg 997ns/call # 30 times (62µs+0s) by Class::MOP::Attribute::new at line 54 of Class/MOP/Attribute.pm, avg 2µs/call # 30 times (24µs+0s) by Class::MOP::Mixin::AttributeCore::default at line 40, avg 790ns/call # once (2µs+0s) by Moose::Meta::Attribute::_inline_generate_default at line 910 of Moose/Meta/Attribute.pm
sub is_default_a_coderef {
28 # Uber hack because it is called from CMOP::Attribute constructor as
29 # $class->is_default_a_coderef(\%options)
3016272µs my ($value) = ref $_[0] ? $_[0]->{'default'} : $_[1]->{'default'};
31
3216257µs return unless ref($value);
33
34121150µs return ref($value) eq 'CODE'
35 || ( blessed($value) && $value->isa('Class::MOP::Method') );
36}
37
38
# spent 337µs (289+48) within Class::MOP::Mixin::AttributeCore::default which was called 374 times, avg 901ns/call: # 286 times (150µs+0s) by Class::MOP::Class::_eval_environment at line 711 of Class/MOP/Class.pm, avg 525ns/call # 55 times (50µs+0s) by Class::MOP::Class::_immutable_metaclass at line 1347 of Class/MOP/Class.pm, avg 902ns/call # 30 times (85µs+48µs) by Class::MOP::Attribute::initialize_instance_slot at line 127 of Class/MOP/Attribute.pm, avg 4µs/call # 3 times (4µs+0s) by Moose::Meta::Attribute::_eval_environment at line 760 of Moose/Meta/Attribute.pm, avg 1µs/call
sub default {
3937440µs my ( $self, $instance ) = @_;
4037485µs5048µs if ( defined $instance && $self->is_default_a_coderef ) {
# spent 24µs making 30 calls to Class::MOP::Mixin::AttributeCore::is_default_a_coderef, avg 790ns/call # spent 3µs making 2 calls to Class::MOP::__ANON__[Class/MOP.pm:139], avg 2µs/call # spent 3µs making 2 calls to Moose::Meta::Class::__ANON__[Moose/Meta/Class.pm:34], avg 1µs/call # spent 2µs making 2 calls to Moose::Meta::Class::__ANON__[Moose/Meta/Class.pm:28], avg 1µs/call # spent 2µs making 2 calls to Class::MOP::__ANON__[Class/MOP.pm:290], avg 1µs/call # spent 2µs making 2 calls to Class::MOP::__ANON__[Class/MOP.pm:243], avg 1µs/call # spent 2µs making 2 calls to Class::MOP::__ANON__[Class/MOP.pm:307], avg 1µs/call # spent 2µs making 2 calls to Class::MOP::__ANON__[Class/MOP.pm:270], avg 1µs/call # spent 2µs making 2 calls to Class::MOP::__ANON__[Class/MOP.pm:184], avg 1µs/call # spent 2µs making 2 calls to Class::MOP::__ANON__[Class/MOP.pm:211], avg 1µs/call # spent 1µs making 1 call to Class::MOP::__ANON__[Class/MOP.pm:499] # spent 1µs making 1 call to Moose::Meta::TypeConstraint::Registry::__ANON__[Moose/Meta/TypeConstraint/Registry.pm:23]
41 # if the default is a CODE ref, then we pass in the instance and
42 # default can return a value based on that instance. Somewhat crude,
43 # but works.
44 return $self->{'default'}->($instance);
45 }
46354314µs $self->{'default'};
47}
48
4912µs1;
50
51# ABSTRACT: Core attributes shared by attribute metaclasses
52
53__END__