← 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:07 2018

Filename/home/ss5/perl5/perlbrew/perls/perl-5.22.0/lib/site_perl/5.22.0/x86_64-linux/Moose/Object.pm
StatementsExecuted 26 statements in 746µs
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
111135µs153µsMoose::Object::::BEGIN@15Moose::Object::BEGIN@15
11145µs46µsMoose::Object::::BEGIN@106Moose::Object::BEGIN@106
11110µs6.08msMoose::Object::::BEGIN@16Moose::Object::BEGIN@16
1119µs10µsMoose::Object::::BEGIN@4Moose::Object::BEGIN@4
1118µs22µsMoose::Object::::BEGIN@79Moose::Object::BEGIN@79
1114µs8µsMoose::Object::::BEGIN@5Moose::Object::BEGIN@5
1112µs2µsMoose::Object::::BEGIN@9Moose::Object::BEGIN@9
1112µs2µsMoose::Object::::BEGIN@8Moose::Object::BEGIN@8
1112µs2µsMoose::Object::::BEGIN@11Moose::Object::BEGIN@11
1112µs2µsMoose::Object::::BEGIN@13Moose::Object::BEGIN@13
1112µs2µsMoose::Object::::BEGIN@7Moose::Object::BEGIN@7
1111µs1µsMoose::Object::::BEGIN@10Moose::Object::BEGIN@10
0000s0sMoose::Object::::BUILDALLMoose::Object::BUILDALL
0000s0sMoose::Object::::BUILDARGSMoose::Object::BUILDARGS
0000s0sMoose::Object::::DEMOLISHALLMoose::Object::DEMOLISHALL
0000s0sMoose::Object::::DESTROYMoose::Object::DESTROY
0000s0sMoose::Object::::__ANON__[:100]Moose::Object::__ANON__[:100]
0000s0sMoose::Object::::__ANON__[:97]Moose::Object::__ANON__[:97]
0000s0sMoose::Object::::doesMoose::Object::does
0000s0sMoose::Object::::dumpMoose::Object::dump
0000s0sMoose::Object::::newMoose::Object::new
Call graph for these subroutines as a Graphviz dot language file.
Line State
ments
Time
on line
Calls Time
in subs
Code
1package Moose::Object;
21400nsour $VERSION = '2.1605';
3
4215µs212µs
# spent 10µs (9+1) within Moose::Object::BEGIN@4 which was called: # once (9µs+1µs) by Moose::BEGIN@30 at line 4
use strict;
# spent 10µs making 1 call to Moose::Object::BEGIN@4 # spent 1µs making 1 call to strict::import
5212µs211µs
# spent 8µs (4+3) within Moose::Object::BEGIN@5 which was called: # once (4µs+3µs) by Moose::BEGIN@30 at line 5
use warnings;
# spent 8µs making 1 call to Moose::Object::BEGIN@5 # spent 3µs making 1 call to warnings::import
6
7211µs12µs
# spent 2µs within Moose::Object::BEGIN@7 which was called: # once (2µs+0s) by Moose::BEGIN@30 at line 7
use Carp ();
# spent 2µs making 1 call to Moose::Object::BEGIN@7
8210µs12µs
# spent 2µs within Moose::Object::BEGIN@8 which was called: # once (2µs+0s) by Moose::BEGIN@30 at line 8
use Devel::GlobalDestruction ();
# spent 2µs making 1 call to Moose::Object::BEGIN@8
928µs12µs
# spent 2µs within Moose::Object::BEGIN@9 which was called: # once (2µs+0s) by Moose::BEGIN@30 at line 9
use MRO::Compat ();
# spent 2µs making 1 call to Moose::Object::BEGIN@9
1028µs11µs
# spent 1µs within Moose::Object::BEGIN@10 which was called: # once (1µs+0s) by Moose::BEGIN@30 at line 10
use Scalar::Util ();
# spent 1µs making 1 call to Moose::Object::BEGIN@10
1129µs12µs
# spent 2µs within Moose::Object::BEGIN@11 which was called: # once (2µs+0s) by Moose::BEGIN@30 at line 11
use Try::Tiny ();
# spent 2µs making 1 call to Moose::Object::BEGIN@11
12
13221µs12µs
# spent 2µs within Moose::Object::BEGIN@13 which was called: # once (2µs+0s) by Moose::BEGIN@30 at line 13
use Moose::Util ();
# spent 2µs making 1 call to Moose::Object::BEGIN@13
14
152148µs2155µs
# spent 153µs (135+18) within Moose::Object::BEGIN@15 which was called: # once (135µs+18µs) by Moose::BEGIN@30 at line 15
use if ( not our $__mx_is_compiled ), 'Moose::Meta::Class';
# spent 153µs making 1 call to Moose::Object::BEGIN@15 # spent 2µs making 1 call to if::import
162255µs26.08ms
# spent 6.08ms (10µs+6.07) within Moose::Object::BEGIN@16 which was called: # once (10µs+6.07ms) by Moose::BEGIN@30 at line 16
use if ( not our $__mx_is_compiled ), metaclass => 'Moose::Meta::Class';
# spent 6.08ms making 1 call to Moose::Object::BEGIN@16 # spent 1µs making 1 call to if::import
17
18sub new {
19 my $class = shift;
20 my $real_class = Scalar::Util::blessed($class) || $class;
21
22 my $params = $real_class->BUILDARGS(@_);
23
24 return Class::MOP::Class->initialize($real_class)->new_object($params);
25}
26
27sub BUILDARGS {
28 my $class = shift;
29 if ( scalar @_ == 1 ) {
30 unless ( defined $_[0] && ref $_[0] eq 'HASH' ) {
31 Moose::Util::throw_exception( "SingleParamsToNewMustBeHashRef" );
32 }
33 return { %{ $_[0] } };
34 }
35 elsif ( @_ % 2 ) {
36 Carp::carp(
37 "The new() method for $class expects a hash reference or a key/value list."
38 . " You passed an odd number of arguments" );
39 return { @_, undef };
40 }
41 else {
42 return { @_ };
43 }
44}
45
46sub BUILDALL {
47 # NOTE: we ask Perl if we even
48 # need to do this first, to avoid
49 # extra meta level calls
50 return unless $_[0]->can('BUILD');
51 my ($self, $params) = @_;
52 foreach my $method (reverse Class::MOP::class_of($self)->find_all_methods_by_name('BUILD')) {
53 $method->{code}->execute($self, $params);
54 }
55}
56
57sub DEMOLISHALL {
58 my $self = shift;
59 my ($in_global_destruction) = @_;
60
61 # NOTE: we ask Perl if we even
62 # need to do this first, to avoid
63 # extra meta level calls
64 return unless $self->can('DEMOLISH');
65
66 my @isa;
67 if ( my $meta = Class::MOP::class_of($self ) ) {
68 @isa = $meta->linearized_isa;
69 } else {
70 # We cannot count on being able to retrieve a previously made
71 # metaclass, _or_ being able to make a new one during global
72 # destruction. However, we should still be able to use mro at
73 # that time (at least tests suggest so ;)
74 my $class_name = ref $self;
75 @isa = @{ mro::get_linear_isa($class_name) }
76 }
77
78 foreach my $class (@isa) {
792118µs235µs
# spent 22µs (8+14) within Moose::Object::BEGIN@79 which was called: # once (8µs+14µs) by Moose::BEGIN@30 at line 79
no strict 'refs';
# spent 22µs making 1 call to Moose::Object::BEGIN@79 # spent 14µs making 1 call to strict::unimport
80 my $demolish = *{"${class}::DEMOLISH"}{CODE};
81 $self->$demolish($in_global_destruction)
82 if defined $demolish;
83 }
84}
85
86sub DESTROY {
87 my $self = shift;
88
89 local $?;
90
91 # < doy> if the destructor is being called because an exception is thrown, then $@ will be set
92 # < doy> but if DEMOLISH does an eval which succeeds, that will clear $@
93 # < doy> which is broken
94 # < doy> try::tiny implicitly localizes $@ in the try block, which fixes that
95 Try::Tiny::try {
96 $self->DEMOLISHALL(Devel::GlobalDestruction::in_global_destruction);
97 }
98 Try::Tiny::catch {
99 die $_;
100 };
101
102 return;
103}
104
105# support for UNIVERSAL::DOES ...
106
# spent 46µs (45+1000ns) within Moose::Object::BEGIN@106 which was called: # once (45µs+1000ns) by Moose::BEGIN@30 at line 113
BEGIN {
10715µs11µs my $does = UNIVERSAL->can("DOES") ? "SUPER::DOES" : "isa";
# spent 1µs making 1 call to UNIVERSAL::can
108141µs eval 'sub DOES {
109 my ( $self, $class_or_role_name ) = @_;
110 return $self->'.$does.'($class_or_role_name)
111 || $self->does($class_or_role_name);
112 }';
113182µs146µs}
# spent 46µs making 1 call to Moose::Object::BEGIN@106
114
115# new does() methods will be created
116# as appropriate see Moose::Meta::Role
117sub does {
118 my ($self, $role_name) = @_;
119 my $class = Scalar::Util::blessed($self) || $self;
120 my $meta = Class::MOP::Class->initialize($class);
121 (defined $role_name)
122 || Moose::Util::throw_exception( DoesRequiresRoleName => class_name => $meta->name );
123 return 1 if $meta->can('does_role') && $meta->does_role($role_name);
124 return 0;
125}
126
127sub dump {
128 my $self = shift;
129 require Data::Dumper;
130 local $Data::Dumper::Maxdepth = shift if @_;
131 Data::Dumper::Dumper $self;
132}
133
13412µs1;
135
136# ABSTRACT: The base object for Moose
137
138__END__