← Index
NYTProf Performance Profile   « block view • line view • sub view »
For mentat.storage.mongo.pl
  Run on Tue Jun 24 09:58:41 2014
Reported on Tue Jun 24 09:59:36 2014

Filename/usr/local/lib/perl/5.14.2/Moose/Object.pm
StatementsExecuted 90 statements in 1.28ms
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
111207µs233µsMoose::Object::::BEGIN@19Moose::Object::BEGIN@19
53280µs282µsMoose::Object::::DESTROYMoose::Object::DESTROY
11159µs60µsMoose::Object::::BEGIN@108Moose::Object::BEGIN@108
33246µs934µsMoose::Object::::newMoose::Object::new
51124µs33µsMoose::Object::::DEMOLISHALLMoose::Object::DEMOLISHALL
11115µs15µsMoose::Object::::BEGIN@13Moose::Object::BEGIN@13
11113µs1.98msMoose::Object::::BEGIN@20Moose::Object::BEGIN@20
11112µs27µsMoose::Object::::BEGIN@85Moose::Object::BEGIN@85
31111µs11µsMoose::Object::::BUILDARGSMoose::Object::BUILDARGS
3119µs19µsMoose::Object::::BUILDALLMoose::Object::BUILDALL
1118µs11µsMoose::Object::::BEGIN@10Moose::Object::BEGIN@10
1118µs15µsMoose::Object::::BEGIN@11Moose::Object::BEGIN@11
1118µs8µsMoose::Object::::BEGIN@3Moose::Object::BEGIN@3
1113µs3µsMoose::Object::::BEGIN@16Moose::Object::BEGIN@16
1113µs3µsMoose::Object::::BEGIN@14Moose::Object::BEGIN@14
1113µs3µsMoose::Object::::BEGIN@15Moose::Object::BEGIN@15
1113µs3µsMoose::Object::::BEGIN@17Moose::Object::BEGIN@17
0000s0sMoose::Object::::__ANON__[:102]Moose::Object::__ANON__[:102]
0000s0sMoose::Object::::__ANON__[:99]Moose::Object::__ANON__[:99]
0000s0sMoose::Object::::doesMoose::Object::does
0000s0sMoose::Object::::dumpMoose::Object::dump
Call graph for these subroutines as a Graphviz dot language file.
Line State
ments
Time
on line
Calls Time
in subs
Code
1
2package Moose::Object;
3
# spent 8µs within Moose::Object::BEGIN@3 which was called: # once (8µs+0s) by Moose::BEGIN@33 at line 5
BEGIN {
414µs $Moose::Object::AUTHORITY = 'cpan:STEVAN';
5130µs18µs}
# spent 8µs making 1 call to Moose::Object::BEGIN@3
6{
721µs $Moose::Object::VERSION = '2.1005';
8}
9
10222µs214µs
# spent 11µs (8+3) within Moose::Object::BEGIN@10 which was called: # once (8µs+3µs) by Moose::BEGIN@33 at line 10
use strict;
# spent 11µs making 1 call to Moose::Object::BEGIN@10 # spent 3µs making 1 call to strict::import
11229µs221µs
# spent 15µs (8+7) within Moose::Object::BEGIN@11 which was called: # once (8µs+7µs) by Moose::BEGIN@33 at line 11
use warnings;
# spent 15µs making 1 call to Moose::Object::BEGIN@11 # spent 7µs making 1 call to warnings::import
12
13231µs115µs
# spent 15µs within Moose::Object::BEGIN@13 which was called: # once (15µs+0s) by Moose::BEGIN@33 at line 13
use Carp ();
# spent 15µs making 1 call to Moose::Object::BEGIN@13
14217µs13µs
# spent 3µs within Moose::Object::BEGIN@14 which was called: # once (3µs+0s) by Moose::BEGIN@33 at line 14
use Devel::GlobalDestruction ();
# spent 3µs making 1 call to Moose::Object::BEGIN@14
15217µs13µs
# spent 3µs within Moose::Object::BEGIN@15 which was called: # once (3µs+0s) by Moose::BEGIN@33 at line 15
use MRO::Compat ();
# spent 3µs making 1 call to Moose::Object::BEGIN@15
16216µs13µs
# spent 3µs within Moose::Object::BEGIN@16 which was called: # once (3µs+0s) by Moose::BEGIN@33 at line 16
use Scalar::Util ();
# spent 3µs making 1 call to Moose::Object::BEGIN@16
17233µs13µs
# spent 3µs within Moose::Object::BEGIN@17 which was called: # once (3µs+0s) by Moose::BEGIN@33 at line 17
use Try::Tiny ();
# spent 3µs making 1 call to Moose::Object::BEGIN@17
18
192228µs2237µs
# spent 233µs (207+26) within Moose::Object::BEGIN@19 which was called: # once (207µs+26µs) by Moose::BEGIN@33 at line 19
use if ( not our $__mx_is_compiled ), 'Moose::Meta::Class';
# spent 233µs making 1 call to Moose::Object::BEGIN@19 # spent 4µs making 1 call to if::import
202311µs21.98ms
# spent 1.98ms (13µs+1.96) within Moose::Object::BEGIN@20 which was called: # once (13µs+1.96ms) by Moose::BEGIN@33 at line 20
use if ( not our $__mx_is_compiled ), metaclass => 'Moose::Meta::Class';
# spent 1.98ms making 1 call to Moose::Object::BEGIN@20 # spent 2µs making 1 call to if::import
21
22
# spent 934µs (46+888) within Moose::Object::new which was called 3 times, avg 311µs/call: # once (20µs+358µs) by main::RUNTIME at line 11 of mentat.storage.mongo.pl # once (16µs+275µs) by Class::MOP::Class:::around at line 48 of MongoDB/Connection.pm # once (9µs+255µs) by main::RUNTIME at line 12 of mentat.storage.mongo.pl
sub new {
2331µs my $class = shift;
2439µs32µs my $real_class = Scalar::Util::blessed($class) || $class;
# spent 2µs making 3 calls to Scalar::Util::blessed, avg 567ns/call
25
26311µs311µs my $params = $real_class->BUILDARGS(@_);
# spent 11µs making 3 calls to Moose::Object::BUILDARGS, avg 4µs/call
27
28322µs6876µs return Class::MOP::Class->initialize($real_class)->new_object($params);
# spent 858µs making 3 calls to Moose::Meta::Class::new_object, avg 286µs/call # spent 18µs making 3 calls to Class::MOP::Class::initialize, avg 6µs/call
29}
30
31
# spent 11µs within Moose::Object::BUILDARGS which was called 3 times, avg 4µs/call: # 3 times (11µs+0s) by Moose::Object::new at line 26, avg 4µs/call
sub BUILDARGS {
3231µs my $class = shift;
3333µs if ( scalar @_ == 1 ) {
34 unless ( defined $_[0] && ref $_[0] eq 'HASH' ) {
35 Class::MOP::class_of($class)->throw_error(
36 "Single parameters to new() must be a HASH ref",
37 data => $_[0] );
38 }
39 return { %{ $_[0] } };
40 }
41 elsif ( @_ % 2 ) {
42 Carp::carp(
43 "The new() method for $class expects a hash reference or a key/value list."
44 . " You passed an odd number of arguments" );
45 return { @_, undef };
46 }
47 else {
4839µs return {@_};
49 }
50}
51
52
# spent 19µs (9+9) within Moose::Object::BUILDALL which was called 3 times, avg 6µs/call: # 3 times (9µs+9µs) by Moose::Meta::Class::new_object at line 288 of Moose/Meta/Class.pm, avg 6µs/call
sub BUILDALL {
53 # NOTE: we ask Perl if we even
54 # need to do this first, to avoid
55 # extra meta level calls
56320µs39µs return unless $_[0]->can('BUILD');
# spent 9µs making 3 calls to UNIVERSAL::can, avg 3µs/call
57 my ($self, $params) = @_;
58 foreach my $method (reverse Class::MOP::class_of($self)->find_all_methods_by_name('BUILD')) {
59 $method->{code}->execute($self, $params);
60 }
61}
62
63
# spent 33µs (24+9) within Moose::Object::DEMOLISHALL which was called 5 times, avg 7µs/call: # 5 times (24µs+9µs) by Moose::Object::try {...} at line 98, avg 7µs/call
sub DEMOLISHALL {
6452µs my $self = shift;
6553µs my ($in_global_destruction) = @_;
66
67 # NOTE: we ask Perl if we even
68 # need to do this first, to avoid
69 # extra meta level calls
70531µs59µs return unless $self->can('DEMOLISH');
# spent 9µs making 5 calls to UNIVERSAL::can, avg 2µs/call
71
72 my @isa;
73 if ( my $meta = Class::MOP::class_of($self ) ) {
74 @isa = $meta->linearized_isa;
75 } else {
76 # We cannot count on being able to retrieve a previously made
77 # metaclass, _or_ being able to make a new one during global
78 # destruction. However, we should still be able to use mro at
79 # that time (at least tests suggest so ;)
80 my $class_name = ref $self;
81 @isa = @{ mro::get_linear_isa($class_name) }
82 }
83
84 foreach my $class (@isa) {
852156µs241µs
# spent 27µs (12+14) within Moose::Object::BEGIN@85 which was called: # once (12µs+14µs) by Moose::BEGIN@33 at line 85
no strict 'refs';
# spent 27µs making 1 call to Moose::Object::BEGIN@85 # spent 14µs making 1 call to strict::unimport
86 my $demolish = *{"${class}::DEMOLISH"}{CODE};
87 $self->$demolish($in_global_destruction)
88 if defined $demolish;
89 }
90}
91
92
# spent 282µs (80+202) within Moose::Object::DESTROY which was called 5 times, avg 56µs/call: # 2 times (33µs+77µs) by Mentat::Storage::Mongo::_unbless at line 916 of Mentat/Storage/Mongo.pm, avg 55µs/call # 2 times (21µs+56µs) by main::NULL at line 0 of mentat.storage.mongo.pl, avg 39µs/call # once (25µs+69µs) by Mentat::Storage::Mongo::disconnect at line 553 of Mentat/Storage/Mongo.pm
sub DESTROY {
9351µs my $self = shift;
94
9559µs local $?;
96
97 Try::Tiny::try {
98525µs1043µs $self->DEMOLISHALL(Devel::GlobalDestruction::in_global_destruction);
# spent 33µs making 5 calls to Moose::Object::DEMOLISHALL, avg 7µs/call # spent 10µs making 5 calls to Devel::GlobalDestruction::in_global_destruction, avg 2µs/call
99 }
100 Try::Tiny::catch {
101 die $_;
102552µs10202µs };
# spent 181µs making 5 calls to Try::Tiny::try, avg 36µs/call # spent 21µs making 5 calls to Try::Tiny::catch, avg 4µs/call
103
104515µs return;
105}
106
107# support for UNIVERSAL::DOES ...
108
# spent 60µs (59+1) within Moose::Object::BEGIN@108 which was called: # once (59µs+1µs) by Moose::BEGIN@33 at line 115
BEGIN {
109110µs11µs my $does = UNIVERSAL->can("DOES") ? "SUPER::DOES" : "isa";
# spent 1µs making 1 call to UNIVERSAL::can
110150µs eval 'sub DOES {
111 my ( $self, $class_or_role_name ) = @_;
112 return $self->'.$does.'($class_or_role_name)
113 || $self->does($class_or_role_name);
114 }';
1151110µs160µs}
# spent 60µs making 1 call to Moose::Object::BEGIN@108
116
117# new does() methods will be created
118# as appropriate see Moose::Meta::Role
119sub does {
120 my ($self, $role_name) = @_;
121 my $class = Scalar::Util::blessed($self) || $self;
122 my $meta = Class::MOP::Class->initialize($class);
123 (defined $role_name)
124 || $meta->throw_error("You must supply a role name to does()");
125 return 1 if $meta->can('does_role') && $meta->does_role($role_name);
126 return 0;
127}
128
129sub dump {
130 my $self = shift;
131 require Data::Dumper;
132 local $Data::Dumper::Maxdepth = shift if @_;
133 Data::Dumper::Dumper $self;
134}
135
13613µs1;
137
138# ABSTRACT: The base object for Moose
139
140__END__