← Index
NYTProf Performance Profile   « block view • line view • sub view »
For bin/pan_genome_post_analysis
  Run on Fri Mar 27 11:43:32 2015
Reported on Fri Mar 27 11:45:55 2015

Filename/Users/ap13/perl5/perlbrew/perls/perl-5.16.2/lib/5.16.2/overload.pm
StatementsExecuted 338 statements in 1.65ms
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
111591µs644µsoverload::::BEGIN@85overload::BEGIN@85
1111360µs364µsoverload::::OVERLOADoverload::OVERLOAD
111110115µs479µsoverload::::importoverload::import
41167µs77µsoverload::::mycanoverload::mycan
41124µs101µsoverload::::Overloadedoverload::Overloaded
11114µs24µsoverload::::BEGIN@116overload::BEGIN@116
11114µs139µsoverload::::BEGIN@146overload::BEGIN@146
6115µs5µsoverload::::CORE:matchoverload::CORE:match (opcode)
0000s0soverload::::AddrRefoverload::AddrRef
0000s0soverload::::Methodoverload::Method
0000s0soverload::::OverloadedStringifyoverload::OverloadedStringify
0000s0soverload::::constantoverload::constant
0000s0soverload::::niloverload::nil
0000s0soverload::::ov_methodoverload::ov_method
0000s0soverload::::remove_constantoverload::remove_constant
0000s0soverload::::unimportoverload::unimport
Call graph for these subroutines as a Graphviz dot language file.
Line State
ments
Time
on line
Calls Time
in subs
Code
1package overload;
2
31700nsour $VERSION = '1.18';
4
5117µs%ops = (
6 with_assign => "+ - * / % ** << >> x .",
7 assign => "+= -= *= /= %= **= <<= >>= x= .=",
8 num_comparison => "< <= > >= == !=",
9 '3way_comparison' => "<=> cmp",
10 str_comparison => "lt le gt ge eq ne",
11 binary => '& &= | |= ^ ^=',
12 unary => "neg ! ~",
13 mutators => '++ --',
14 func => "atan2 cos sin exp abs log sqrt int",
15 conversion => 'bool "" 0+ qr',
16 iterators => '<>',
17 filetest => "-X",
18 dereferencing => '${} @{} %{} &{} *{}',
19 matching => '~~',
20 special => 'nomethod fallback =',
21);
22
231200nsmy %ops_seen;
2415µsfor $category (keys %ops) {
2515165µs $ops_seen{$_}++ for (split /\s+/, $ops{$category});
26}
27
28sub nil {}
29
30
# spent 364µs (360+5) within overload::OVERLOAD which was called 11 times, avg 33µs/call: # 11 times (360µs+5µs) by overload::import at line 59, avg 33µs/call
sub OVERLOAD {
31115µs $package = shift;
321128µs my %arg = @_;
33115µs my ($sub, $fb);
341153µs $ {$package . "::OVERLOAD"}{dummy}++; # Register with magic by touching.
351120µs $fb = ${$package . "::()"}; # preserve old fallback value RT#68196
361123µs *{$package . "::()"} = \&nil; # Make it findable via fetchmethod.
371129µs for (keys %arg) {
383327µs if ($_ eq 'fallback') {
39 $fb = $arg{$_};
40 } else {
412410µs warnings::warnif("overload arg '$_' is invalid")
42 unless $ops_seen{$_};
43249µs $sub = $arg{$_};
442429µs65µs if (not ref $sub and $sub !~ /::/) {
# spent 5µs making 6 calls to overload::CORE:match, avg 783ns/call
45613µs $ {$package . "::(" . $_} = $sub;
4664µs $sub = \&nil;
47 }
48 #print STDERR "Setting '$ {'package'}::\cO$_' to \\&'$sub'.\n";
492449µs *{$package . "::(" . $_} = \&{ $sub };
50 }
51 }
521155µs ${$package . "::()"} = $fb; # Make it findable too (fallback only).
53}
54
55
# spent 479µs (115+364) within overload::import which was called 11 times, avg 44µs/call: # once (14µs+45µs) by Text::CSV::ErrorDiag::BEGIN@1088 at line 1094 of Text/CSV_PP.pm # once (9µs+42µs) by Error::BEGIN@20 at line 25 of Error.pm # once (12µs+38µs) by Moose::Meta::TypeConstraint::BEGIN@8 at line 11 of Moose/Meta/TypeConstraint.pm # once (10µs+35µs) by Graph::BEGIN@116 at line 118 of Graph.pm # once (10µs+36µs) by File::Temp::BEGIN@33 at line 34 of File/Temp.pm # once (12µs+31µs) by Moose::Meta::Role::Method::Required::BEGIN@8 at line 9 of Moose/Meta/Role/Method/Required.pm # once (12µs+27µs) by Getopt::Long::CallBack::BEGIN@1544 at line 1545 of Getopt/Long.pm # once (12µs+27µs) by Class::MOP::Method::BEGIN@14 at line 14 of Class/MOP/Method.pm # once (8µs+30µs) by File::Temp::Dir::BEGIN@1576 at line 1578 of File/Temp.pm # once (6µs+29µs) by Exception::Class::Base::BEGIN@42 at line 42 of Exception/Class/Base.pm # once (10µs+23µs) by Devel::StackTrace::BEGIN@15 at line 16 of Devel/StackTrace.pm
sub import {
561126µs $package = (caller())[0];
57 # *{$package . "::OVERLOAD"} = \&OVERLOAD;
58112µs shift;
591181µs11364µs $package->overload::OVERLOAD(@_);
# spent 364µs making 11 calls to overload::OVERLOAD, avg 33µs/call
60}
61
62sub unimport {
63 $package = (caller())[0];
64 ${$package . "::OVERLOAD"}{dummy}++; # Upgrade the table
65 shift;
66 for (@_) {
67 if ($_ eq 'fallback') {
68 undef $ {$package . "::()"};
69 } else {
70 delete $ {$package . "::"}{"(" . $_};
71 }
72 }
73}
74
75
# spent 101µs (24+77) within overload::Overloaded which was called 4 times, avg 25µs/call: # 4 times (24µs+77µs) by Class::MOP::Mixin::HasOverloads::is_overloaded at line 19 of Class/MOP/Mixin/HasOverloads.pm, avg 25µs/call
sub Overloaded {
7642µs my $package = shift;
774900ns $package = ref $package if ref $package;
78415µs477µs mycan ($package, '()');
# spent 77µs making 4 calls to overload::mycan, avg 19µs/call
79}
80
81sub ov_method {
82 my $globref = shift;
83 return undef unless $globref;
84 my $sub = \&{*$globref};
852399µs2660µs
# spent 644µs (591+53) within overload::BEGIN@85 which was called: # once (591µs+53µs) by Data::OptList::BEGIN@10 at line 85
no overloading;
# spent 644µs making 1 call to overload::BEGIN@85 # spent 16µs making 1 call to overloading::unimport
86 return $sub if !ref $sub or $sub != \&nil;
87 return shift->can($ {*$globref});
88}
89
90sub OverloadedStringify {
91 my $package = shift;
92 $package = ref $package if ref $package;
93 #$package->can('(""')
94 ov_method mycan($package, '(""'), $package
95 or ov_method mycan($package, '(0+'), $package
96 or ov_method mycan($package, '(bool'), $package
97 or ov_method mycan($package, '(nomethod'), $package;
98}
99
100sub Method {
101 my $package = shift;
102 if(ref $package) {
103 local $@;
104 local $!;
105 require Scalar::Util;
106 $package = Scalar::Util::blessed($package);
107 return undef if !defined $package;
108 }
109 #my $meth = $package->can('(' . shift);
110 ov_method mycan($package, '(' . shift), $package;
111 #return $meth if $meth ne \&nil;
112 #return $ {*{$meth}};
113}
114
115sub AddrRef {
1162175µs233µs
# spent 24µs (14+10) within overload::BEGIN@116 which was called: # once (14µs+10µs) by Data::OptList::BEGIN@10 at line 116
no overloading;
# spent 24µs making 1 call to overload::BEGIN@116 # spent 10µs making 1 call to overloading::unimport
117 "$_[0]";
118}
119
12012µs*StrVal = *AddrRef;
121
122
# spent 77µs (67+10) within overload::mycan which was called 4 times, avg 19µs/call: # 4 times (67µs+10µs) by overload::Overloaded at line 78, avg 19µs/call
sub mycan { # Real can would leave stubs.
12344µs my ($package, $meth) = @_;
124
12541µs local $@;
126410µs local $!;
12743µs require mro;
128
129424µs410µs my $mro = mro::get_linear_isa($package);
# spent 10µs making 4 calls to mro::get_linear_isa, avg 3µs/call
13043µs foreach my $p (@$mro) {
13144µs my $fqmeth = $p . q{::} . $meth;
132413µs return \*{$fqmeth} if defined &{$fqmeth};
133 }
134
135414µs return undef;
136}
137
13812µs%constants = (
139 'integer' => 0x1000, # HINT_NEW_INTEGER
140 'float' => 0x2000, # HINT_NEW_FLOAT
141 'binary' => 0x4000, # HINT_NEW_BINARY
142 'q' => 0x8000, # HINT_NEW_STRING
143 'qr' => 0x10000, # HINT_NEW_RE
144 );
145
1462296µs2265µs
# spent 139µs (14+125) within overload::BEGIN@146 which was called: # once (14µs+125µs) by Data::OptList::BEGIN@10 at line 146
use warnings::register;
# spent 139µs making 1 call to overload::BEGIN@146 # spent 125µs making 1 call to warnings::register::import
147sub constant {
148 # Arguments: what, sub
149 while (@_) {
150 if (@_ == 1) {
151 warnings::warnif ("Odd number of arguments for overload::constant");
152 last;
153 }
154 elsif (!exists $constants {$_ [0]}) {
155 warnings::warnif ("'$_[0]' is not an overloadable type");
156 }
157 elsif (!ref $_ [1] || "$_[1]" !~ /(^|=)CODE\(0x[0-9a-f]+\)$/) {
158 # Can't use C<ref $_[1] eq "CODE"> above as code references can be
159 # blessed, and C<ref> would return the package the ref is blessed into.
160 if (warnings::enabled) {
161 $_ [1] = "undef" unless defined $_ [1];
162 warnings::warn ("'$_[1]' is not a code reference");
163 }
164 }
165 else {
166 $^H{$_[0]} = $_[1];
167 $^H |= $constants{$_[0]};
168 }
169 shift, shift;
170 }
171}
172
173sub remove_constant {
174 # Arguments: what, sub
175 while (@_) {
176 delete $^H{$_[0]};
177 $^H &= ~ $constants{$_[0]};
178 shift, shift;
179 }
180}
181
182122µs1;
183
184__END__
 
# spent 5µs within overload::CORE:match which was called 6 times, avg 783ns/call: # 6 times (5µs+0s) by overload::OVERLOAD at line 44, avg 783ns/call
sub overload::CORE:match; # opcode