← Index
NYTProf Performance Profile   « line view »
For fastest.pl
  Run on Fri Jan 31 20:48:16 2014
Reported on Fri Jan 31 20:49:41 2014

Filename/opt/perl-5.18.1/lib/site_perl/5.18.1/Moo/Object.pm
StatementsExecuted 28 statements in 738µs
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
42147µs61µsMoo::Object::::newMoo::Object::new
11121µs76µsMoo::Object::::BEGIN@3Moo::Object::BEGIN@3
11111µs23µsMoo::Object::::BEGIN@68Moo::Object::BEGIN@68
0000s0sMoo::Object::::BUILDALLMoo::Object::BUILDALL
0000s0sMoo::Object::::BUILDARGSMoo::Object::BUILDARGS
0000s0sMoo::Object::::DEMOLISHALLMoo::Object::DEMOLISHALL
0000s0sMoo::Object::::doesMoo::Object::does
0000s0sMoo::Object::::metaMoo::Object::meta
Call graph for these subroutines as a Graphviz dot language file.
Line State
ments
Time
on line
Calls Time
in subs
Code
1package Moo::Object;
2
33543µs3132µs
# spent 76µs (21+56) within Moo::Object::BEGIN@3 which was called: # once (21µs+56µs) by Moo::import at line 3
use strictures 1;
# spent 76µs making 1 call to Moo::Object::BEGIN@3 # spent 40µs making 1 call to strictures::import # spent 16µs making 1 call to strictures::VERSION
4
51200nsour %NO_BUILD;
61100nsour %NO_DEMOLISH;
710sour $BUILD_MAKER;
810sour $DEMOLISH_MAKER;
9
10
# spent 61µs (47+14) within Moo::Object::new which was called 4 times, avg 15µs/call: # 3 times (34µs+9µs) by Moo::_accessor_maker_for at line 139 of Moo.pm, avg 14µs/call # once (12µs+5µs) by Moo::_constructor_maker_for at line 189 of Moo.pm
sub new {
1141µs my $class = shift;
1242µs unless (exists $NO_DEMOLISH{$class}) {
13223µs26µs unless ($NO_DEMOLISH{$class} = !$class->can('DEMOLISH')) {
# spent 6µs making 2 calls to UNIVERSAL::can, avg 3µs/call
14 ($DEMOLISH_MAKER ||= do {
15 require Method::Generate::DemolishAll;
16 Method::Generate::DemolishAll->new
17 })->generate_method($class);
18 }
19 }
20 $NO_BUILD{$class} and
2149µs return bless({ ref($_[0]) eq 'HASH' ? %{$_[0]} : @_ }, $class);
22216µs28µs $NO_BUILD{$class} = !$class->can('BUILD') unless exists $NO_BUILD{$class};
# spent 8µs making 2 calls to UNIVERSAL::can, avg 4µs/call
23 $NO_BUILD{$class}
24 ? bless({ ref($_[0]) eq 'HASH' ? %{$_[0]} : @_ }, $class)
25213µs : do {
26 my $proto = ref($_[0]) eq 'HASH' ? $_[0] : { @_ };
27 bless({ %$proto }, $class)->BUILDALL($proto);
28 };
29}
30
31# Inlined into Method::Generate::Constructor::_generate_args() - keep in sync
32sub BUILDARGS {
33 my $class = shift;
34 if ( scalar @_ == 1 ) {
35 unless ( defined $_[0] && ref $_[0] eq 'HASH' ) {
36 die "Single parameters to new() must be a HASH ref"
37 ." data => ". $_[0] ."\n";
38 }
39 return { %{ $_[0] } };
40 }
41 elsif ( @_ % 2 ) {
42 die "The new() method for $class expects a hash reference or a key/value list."
43 . " You passed an odd number of arguments\n";
44 }
45 else {
46 return {@_};
47 }
48}
49
50sub BUILDALL {
51 my $self = shift;
52 $self->${\(($BUILD_MAKER ||= do {
53 require Method::Generate::BuildAll;
54 Method::Generate::BuildAll->new
55 })->generate_method(ref($self)))}(@_);
56}
57
58sub DEMOLISHALL {
59 my $self = shift;
60 $self->${\(($DEMOLISH_MAKER ||= do {
61 require Method::Generate::DemolishAll;
62 Method::Generate::DemolishAll->new
63 })->generate_method(ref($self)))}(@_);
64}
65
66sub does {
67 require Role::Tiny;
682126µs234µs
# spent 23µs (11+12) within Moo::Object::BEGIN@68 which was called: # once (11µs+12µs) by Moo::import at line 68
{ no warnings 'redefine'; *does = \&Role::Tiny::does_role }
# spent 23µs making 1 call to Moo::Object::BEGIN@68 # spent 12µs making 1 call to warnings::unimport
69 goto &Role::Tiny::does_role;
70}
71
72# duplicated in Moo::Role
73sub meta {
74 require Moo::HandleMoose::FakeMetaClass;
75 my $class = ref($_[0])||$_[0];
76 bless({ name => $class }, 'Moo::HandleMoose::FakeMetaClass');
77}
78
7914µs1;