← Index
NYTProf Performance Profile   « line view »
For ../dm5dm6_ex3
  Run on Tue Feb 24 07:41:47 2015
Reported on Tue Feb 24 07:41:51 2015

Filename/usr/lib/perl5/5.20.1/Exporter.pm
StatementsExecuted 348 statements in 1.09ms
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
232314902µs1.02msExporter::::importExporter::import
321883µs925µsExporter::::as_heavyExporter::as_heavy
2462148µs48µsExporter::::CORE:matchExporter::CORE:match (opcode)
201219µs9µsExporter::::CORE:substExporter::CORE:subst (opcode)
2226µs20µsExporter::::exportExporter::export
1113µs915µsExporter::::export_to_levelExporter::export_to_level
0000s0sExporter::::__ANON__[:64]Exporter::__ANON__[:64]
0000s0sExporter::::export_failExporter::export_fail
0000s0sExporter::::export_ok_tagsExporter::export_ok_tags
0000s0sExporter::::export_tagsExporter::export_tags
0000s0sExporter::::require_versionExporter::require_version
Call graph for these subroutines as a Graphviz dot language file.
Line State
ments
Time
on line
Calls Time
in subs
Code
1package Exporter;
2
315µsrequire 5.006;
4
5# Be lean.
6#use strict;
7#no strict 'refs';
8
91200nsour $Debug = 0;
1010sour $ExportLevel = 0;
111200nsour $Verbose ||= 0;
121200nsour $VERSION = '5.71';
131100nsour (%Cache);
14
15
# spent 925µs (883+43) within Exporter::as_heavy which was called 3 times, avg 308µs/call: # 2 times (10µs+4µs) by Exporter::export at line 25, avg 7µs/call # once (873µs+39µs) by Exporter::export_to_level at line 81
sub as_heavy {
16356µs require Exporter::Heavy;
17 # Unfortunately, this does not work if the caller is aliased as *name = \&foo
18 # Thus the need to create a lot of identical subroutines
1934µs my $c = (caller(1))[3];
20314µs36µs $c =~ s/.*:://;
# spent 6µs making 3 calls to Exporter::CORE:subst, avg 2µs/call
2138µs \&{"Exporter::Heavy::heavy_$c"};
22}
23
24
# spent 20µs (6+13) within Exporter::export which was called 2 times, avg 10µs/call: # once (4µs+9µs) by Exporter::import at line 62 # once (2µs+4µs) by Exporter::Heavy::heavy_export_to_level at line 219 of Exporter/Heavy.pm
sub export {
2527µs4160µs goto &{as_heavy()};
# spent 146µs making 2 calls to Exporter::Heavy::heavy_export, avg 73µs/call # spent 13µs making 2 calls to Exporter::as_heavy, avg 7µs/call
26}
27
28
# spent 1.02ms (902µs+122µs) within Exporter::import which was called 23 times, avg 45µs/call: # once (156µs+3µs) by IO::Seekable::BEGIN@104 at line 104 of IO/Seekable.pm # once (97µs+4µs) by Date::Manip::Delta::BEGIN@21 at line 21 of Date/Manip/Delta.pm # once (96µs+5µs) by Date::Manip::TZ::BEGIN@22 at line 22 of Date/Manip/TZ.pm # once (11µs+73µs) by Storable::BEGIN@53 at line 54 of Storable.pm # once (68µs+3µs) by Date::Manip::Obj::BEGIN@12 at line 147 of IO/File.pm # once (63µs+4µs) by Date::Manip::Date::BEGIN@22 at line 22 of Date/Manip/Date.pm # once (60µs+4µs) by Date::Manip::TZ_Base::BEGIN@12 at line 12 of Date/Manip/TZ_Base.pm # once (56µs+4µs) by Date::Manip::Obj::BEGIN@12 at line 12 of Date/Manip/Obj.pm # once (55µs+1µs) by Date::Manip::Base::BEGIN@24 at line 24 of Date/Manip/Base.pm # once (30µs+11µs) by Date::Manip::Obj::BEGIN@13 at line 13 of Date/Manip/Obj.pm # once (34µs+3µs) by IO::File::BEGIN@130 at line 130 of IO/File.pm # once (22µs+1µs) by IO::File::BEGIN@131 at line 131 of IO/File.pm # once (20µs+800ns) by IO::Seekable::BEGIN@98 at line 98 of IO/Seekable.pm # once (18µs+800ns) by IO::File::BEGIN@133 at line 133 of IO/File.pm # once (18µs+800ns) by IO::Handle::BEGIN@266 at line 266 of IO/Handle.pm # once (18µs+700ns) by SelectSaver::BEGIN@38 at line 38 of SelectSaver.pm # once (16µs+600ns) by Encode::BEGIN@47 at line 47 of Encode.pm # once (16µs+700ns) by IO::BEGIN@6 at line 6 of IO.pm # once (15µs+700ns) by IO::Handle::BEGIN@267 at line 267 of IO/Handle.pm # once (14µs+600ns) by SelectSaver::BEGIN@39 at line 39 of SelectSaver.pm # once (11µs+400ns) by Date::Manip::Date::BEGIN@23 at line 23 of Date/Manip/Date.pm # once (4µs+0s) by Encode::BEGIN@12 at line 12 of Encode.pm # once (3µs+0s) by Encode::Alias::BEGIN@8 at line 8 of Encode/Alias.pm
sub import {
29235µs my $pkg = shift;
30239µs my $callpkg = caller($ExportLevel);
31
32236µs if ($pkg eq "Exporter" and @_ and $_[0] eq "import") {
3323µs *{$callpkg."::import"} = \&import;
34212µs return;
35 }
36
37 # We *need* to treat @{"$pkg\::EXPORT_FAIL"} since Carp uses it :-(
382119µs my $exports = \@{"$pkg\::EXPORT"};
39 # But, avoid creating things if they don't exist, which saves a couple of
40 # hundred bytes per package processed.
412114µs my $fail = ${$pkg . '::'}{EXPORT_FAIL} && \@{"$pkg\::EXPORT_FAIL"};
42217µs return export $pkg, $callpkg, @_
43 if $Verbose or $Debug or $fail && @$fail > 1;
442110µs my $export_cache = ($Cache{$pkg} ||= {});
452129µs my $args = @_ or @_ = @$exports;
46
47215µs if ($args and not %$export_cache) {
48 s/^&//, $export_cache->{$_} = 1
493188µs1982µs foreach (@$exports, @{"$pkg\::EXPORT_OK"});
# spent 2µs making 198 calls to Exporter::CORE:subst, avg 13ns/call
50 }
51212µs my $heavy;
52 # Try very hard not to use {} and hence have to enter scope on the foreach
53 # We bomb out of the loop with last as soon as heavy is set.
54217µs if ($args or $fail) {
55 ($heavy = (/\W/ or $args and not exists $export_cache->{$_}
56 or $fail and @$fail and $_ eq $fail->[0])) and last
571194µs5923µs foreach (@_);
# spent 23µs making 59 calls to Exporter::CORE:match, avg 392ns/call
58 } else {
59 ($heavy = /\W/) and last
6010185µs18725µs foreach (@_);
# spent 25µs making 187 calls to Exporter::CORE:match, avg 133ns/call
61 }
62215µs113µs return export $pkg, $callpkg, ($args ? @_ : ()) if $heavy;
# spent 13µs making 1 call to Exporter::export
63 local $SIG{__WARN__} =
642055µs sub {require Carp; &Carp::carp} if not $SIG{__WARN__};
65 # shortcut for the common case of no type character
6620331µs *{"$callpkg\::$_"} = \&{"$pkg\::$_"} foreach @_;
67}
68
69# Default methods
70
71sub export_fail {
72 my $self = shift;
73 @_;
74}
75
76# Unfortunately, caller(1)[3] "does not work" if the caller is aliased as
77# *name = \&foo. Thus the need to create a lot of identical subroutines
78# Otherwise we could have aliased them to export().
79
80
# spent 915µs (3+912) within Exporter::export_to_level which was called: # once (3µs+912µs) by Time::HiRes::import at line 63 of Time/HiRes.pm
sub export_to_level {
8115µs21.01ms goto &{as_heavy()};
# spent 912µs making 1 call to Exporter::as_heavy # spent 102µs making 1 call to Exporter::Heavy::heavy_export_to_level
82}
83
84sub export_tags {
85 goto &{as_heavy()};
86}
87
88sub export_ok_tags {
89 goto &{as_heavy()};
90}
91
92sub require_version {
93 goto &{as_heavy()};
94}
95
9613µs1;
97__END__
 
# spent 48µs within Exporter::CORE:match which was called 246 times, avg 195ns/call: # 187 times (25µs+0s) by Exporter::import at line 60, avg 133ns/call # 59 times (23µs+0s) by Exporter::import at line 57, avg 392ns/call
sub Exporter::CORE:match; # opcode
# spent 9µs within Exporter::CORE:subst which was called 201 times, avg 45ns/call: # 198 times (2µs+0s) by Exporter::import at line 49, avg 13ns/call # 3 times (6µs+0s) by Exporter::as_heavy at line 20, avg 2µs/call
sub Exporter::CORE:subst; # opcode