Filename | /home/ss5/perl5/perlbrew/perls/tapper-perl/lib/5.16.3/Exporter.pm |
Statements | Executed 770 statements in 3.21ms |
Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
---|---|---|---|---|---|
49 | 49 | 31 | 2.64ms | 6.08ms | import | Exporter::
5 | 3 | 1 | 1.54ms | 1.64ms | as_heavy | Exporter::
291 | 2 | 1 | 120µs | 120µs | CORE:match (opcode) | Exporter::
249 | 2 | 1 | 65µs | 65µs | CORE:subst (opcode) | Exporter::
3 | 2 | 2 | 18µs | 58µs | export | Exporter::
1 | 1 | 1 | 10µs | 1.60ms | export_to_level | Exporter::
1 | 1 | 1 | 8µs | 25µs | export_ok_tags | Exporter::
0 | 0 | 0 | 0s | 0s | __ANON__[:64] | Exporter::
0 | 0 | 0 | 0s | 0s | export_fail | Exporter::
0 | 0 | 0 | 0s | 0s | export_tags | Exporter::
0 | 0 | 0 | 0s | 0s | require_version | Exporter::
Line | State ments |
Time on line |
Calls | Time in subs |
Code |
---|---|---|---|---|---|
1 | package Exporter; | ||||
2 | |||||
3 | 1 | 11µs | require 5.006; | ||
4 | |||||
5 | # Be lean. | ||||
6 | #use strict; | ||||
7 | #no strict 'refs'; | ||||
8 | |||||
9 | 1 | 500ns | our $Debug = 0; | ||
10 | 1 | 100ns | our $ExportLevel = 0; | ||
11 | 1 | 300ns | our $Verbose ||= 0; | ||
12 | 1 | 400ns | our $VERSION = '5.66'; | ||
13 | 1 | 400ns | our (%Cache); | ||
14 | |||||
15 | sub as_heavy { | ||||
16 | 5 | 79µ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 | ||||
19 | 5 | 19µs | my $c = (caller(1))[3]; | ||
20 | 5 | 43µs | 5 | 21µs | $c =~ s/.*:://; # spent 21µs making 5 calls to Exporter::CORE:subst, avg 4µs/call |
21 | 5 | 28µs | \&{"Exporter::Heavy::heavy_$c"}; | ||
22 | } | ||||
23 | |||||
24 | # spent 58µs (18+40) within Exporter::export which was called 3 times, avg 19µs/call:
# 2 times (13µs+30µs) by Exporter::import at line 62, avg 21µs/call
# once (6µs+10µs) by Exporter::Heavy::heavy_export_to_level at line 214 of Exporter/Heavy.pm | ||||
25 | 3 | 24µs | 6 | 3.47ms | goto &{as_heavy()}; # spent 3.43ms making 3 calls to Exporter::Heavy::heavy_export, avg 1.14ms/call
# spent 40µs making 3 calls to Exporter::as_heavy, avg 13µs/call |
26 | } | ||||
27 | |||||
28 | # spent 6.08ms (2.64+3.44) within Exporter::import which was called 49 times, avg 124µs/call:
# once (225µs+3.10ms) by POSIX::import at line 30 of POSIX.pm
# once (430µs+31µs) by POSIX::BEGIN@11 at line 11 of POSIX.pm
# once (62µs+210µs) by Safe::BEGIN@46 at line 46 of Safe.pm
# once (199µs+11µs) by main::BEGIN@7 at line 7 of t/optimization.t
# once (94µs+5µs) by Data::DPath::Context::BEGIN@10 at line 10 of lib/Data/DPath/Context.pm
# once (75µs+4µs) by Data::DPath::Context::BEGIN@13 at line 13 of lib/Data/DPath/Context.pm
# once (70µs+5µs) by Data::DPath::Context::BEGIN@14 at line 34 of List/Util.pm
# once (65µs+9µs) by Data::DPath::Path::BEGIN@11 at line 11 of lib/Data/DPath/Path.pm
# once (67µs+6µs) by Test::Deep::BEGIN@5 at line 5 of Test/Deep.pm
# once (68µs+4µs) by Test::Deep::Cache::Simple::BEGIN@7 at line 7 of Test/Deep/Cache/Simple.pm
# once (69µs+3µs) by IO::Handle::BEGIN@264 at line 264 of IO/Handle.pm
# once (50µs+3µs) by Opcode::BEGIN@11 at line 11 of Opcode.pm
# once (46µs+2µs) by IO::Handle::BEGIN@263 at line 263 of IO/Handle.pm
# once (44µs+1µs) by Test::Deep::Shallow::BEGIN@8 at line 8 of Test/Deep/Shallow.pm
# once (42µs+2µs) by Tie::Hash::BEGIN@188 at line 188 of Tie/Hash.pm
# once (42µs+2µs) by Sub::Install::BEGIN@6 at line 6 of Sub/Install.pm
# once (42µs+2µs) by Data::Dumper::BEGIN@22 at line 22 of Data/Dumper.pm
# once (42µs+2µs) by Text::Balanced::BEGIN@343 at line 343 of Text/Balanced.pm
# once (40µs+2µs) by Data::DPath::Path::BEGIN@7 at line 7 of lib/Data/DPath/Path.pm
# once (39µs+2µs) by Text::Balanced::BEGIN@885 at line 885 of Text/Balanced.pm
# once (39µs+0s) by Test::Deep::BEGIN@12 at line 12 of Test/Deep.pm
# once (37µs+2µs) by Class::XSAccessor::Heavy::BEGIN@7 at line 7 of Class/XSAccessor/Heavy.pm
# once (37µs+2µs) by SelectSaver::BEGIN@38 at line 38 of SelectSaver.pm
# once (36µs+2µs) by Safe::BEGIN@29 at line 29 of Safe.pm
# once (34µs+2µs) by IO::BEGIN@6 at line 6 of IO.pm
# once (34µs+2µs) by Safe::BEGIN@4 at line 4 of Safe.pm
# once (34µs+2µs) by SelectSaver::BEGIN@39 at line 39 of SelectSaver.pm
# once (33µs+1µs) by Test::Deep::Blessed::BEGIN@8 at line 8 of Test/Deep/Blessed.pm
# once (32µs+1µs) by Devel::StackTrace::BEGIN@13 at line 13 of Devel/StackTrace.pm
# once (31µs+1µs) by Class::XSAccessor::Array::BEGIN@5 at line 5 of Class/XSAccessor/Array.pm
# once (30µs+1µs) by Data::OptList::BEGIN@10 at line 95 of Params/Util.pm
# once (30µs+1µs) by Exception::Class::BEGIN@11 at line 11 of Exception/Class.pm
# once (29µs+1µs) by Test::Deep::Cache::Simple::BEGIN@5 at line 5 of Test/Deep/Cache/Simple.pm
# once (29µs+1µs) by Test::Deep::Ref::BEGIN@8 at line 8 of Test/Deep/Ref.pm
# once (29µs+1µs) by Text::Balanced::BEGIN@9 at line 9 of Text/Balanced.pm
# once (29µs+1µs) by Exception::Class::Base::BEGIN@11 at line 11 of Exception/Class/Base.pm
# once (28µs+1µs) by Test::Deep::Stack::BEGIN@6 at line 6 of Test/Deep/Stack.pm
# once (28µs+1µs) by Test::Deep::RefType::BEGIN@8 at line 8 of Test/Deep/RefType.pm
# once (27µs+1µs) by Class::XSAccessor::BEGIN@5 at line 5 of Class/XSAccessor.pm
# once (27µs+1µs) by Data::DPath::Context::BEGIN@7 at line 7 of lib/Data/DPath/Context.pm
# once (26µs+900ns) by Data::DPath::Context::BEGIN@11 at line 11 of lib/Data/DPath/Context.pm
# once (26µs+1µs) by Test::Deep::Cache::Simple::BEGIN@10 at line 19 of Test/Deep/Cache/Simple.pm
# once (26µs+1µs) by Data::DPath::Filters::BEGIN@7 at line 7 of lib/Data/DPath/Filters.pm
# once (25µs+1µs) by main::BEGIN@9 at line 9 of t/optimization.t
# once (22µs+0s) by Test::Deep::Cmp::BEGIN@12 at line 12 of Test/Deep/Cmp.pm
# once (21µs+0s) by SelfLoader::BEGIN@4 at line 4 of SelfLoader.pm
# once (19µs+0s) by SelfLoader::BEGIN@42 at line 42 of SelfLoader.pm
# once (16µs+0s) by Data::DPath::Filters::BEGIN@8 at line 8 of lib/Data/DPath/Filters.pm
# once (15µs+0s) by Test::Deep::Stack::BEGIN@7 at line 7 of Test/Deep/Stack.pm | ||||
29 | 49 | 27µs | my $pkg = shift; | ||
30 | 49 | 46µs | my $callpkg = caller($ExportLevel); | ||
31 | |||||
32 | 49 | 21µs | if ($pkg eq "Exporter" and @_ and $_[0] eq "import") { | ||
33 | *{$callpkg."::import"} = \&import; | ||||
34 | return; | ||||
35 | } | ||||
36 | |||||
37 | # We *need* to treat @{"$pkg\::EXPORT_FAIL"} since Carp uses it :-( | ||||
38 | 49 | 114µ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. | ||||
41 | 49 | 97µs | my $fail = ${$pkg . '::'}{EXPORT_FAIL} && \@{"$pkg\::EXPORT_FAIL"}; | ||
42 | 49 | 33µs | return export $pkg, $callpkg, @_ | ||
43 | if $Verbose or $Debug or $fail && @$fail > 1; | ||||
44 | 49 | 46µs | my $export_cache = ($Cache{$pkg} ||= {}); | ||
45 | 49 | 103µs | my $args = @_ or @_ = @$exports; | ||
46 | |||||
47 | 49 | 22µs | if ($args and not %$export_cache) { | ||
48 | s/^&//, $export_cache->{$_} = 1 | ||||
49 | 7 | 540µs | 244 | 45µs | foreach (@$exports, @{"$pkg\::EXPORT_OK"}); # spent 45µs making 244 calls to Exporter::CORE:subst, avg 183ns/call |
50 | } | ||||
51 | 49 | 9µ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. | ||||
54 | 49 | 32µ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 | ||||
57 | 37 | 408µs | 100 | 67µs | foreach (@_); # spent 67µs making 100 calls to Exporter::CORE:match, avg 673ns/call |
58 | } else { | ||||
59 | ($heavy = /\W/) and last | ||||
60 | 12 | 360µs | 191 | 53µs | foreach (@_); # spent 53µs making 191 calls to Exporter::CORE:match, avg 279ns/call |
61 | } | ||||
62 | 49 | 50µs | 2 | 42µs | return export $pkg, $callpkg, ($args ? @_ : ()) if $heavy; # spent 42µs making 2 calls to Exporter::export, avg 21µs/call |
63 | local $SIG{__WARN__} = | ||||
64 | 47 | 244µs | sub {require Carp; &Carp::carp} if not $SIG{__WARN__}; | ||
65 | # shortcut for the common case of no type character | ||||
66 | 47 | 827µs | *{"$callpkg\::$_"} = \&{"$pkg\::$_"} foreach @_; | ||
67 | } | ||||
68 | |||||
69 | # Default methods | ||||
70 | |||||
71 | sub 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 1.60ms (10µs+1.58) within Exporter::export_to_level which was called:
# once (10µs+1.58ms) by Test::Builder::Module::import at line 93 of Test/Builder/Module.pm | ||||
81 | 1 | 14µs | 2 | 1.82ms | goto &{as_heavy()}; # spent 1.58ms making 1 call to Exporter::as_heavy
# spent 231µs making 1 call to Exporter::Heavy::heavy_export_to_level |
82 | } | ||||
83 | |||||
84 | sub export_tags { | ||||
85 | goto &{as_heavy()}; | ||||
86 | } | ||||
87 | |||||
88 | # spent 25µs (8+16) within Exporter::export_ok_tags which was called:
# once (8µs+16µs) by Data::DPath::Path::BEGIN@11 at line 31 of Text/Balanced.pm | ||||
89 | 1 | 9µs | 2 | 40µs | goto &{as_heavy()}; # spent 24µs making 1 call to Exporter::Heavy::heavy_export_ok_tags
# spent 16µs making 1 call to Exporter::as_heavy |
90 | } | ||||
91 | |||||
92 | sub require_version { | ||||
93 | goto &{as_heavy()}; | ||||
94 | } | ||||
95 | |||||
96 | 1 | 5µs | 1; | ||
97 | __END__ | ||||
sub Exporter::CORE:match; # opcode | |||||
sub Exporter::CORE:subst; # opcode |