Filename | /usr/share/perl/5.28/Exporter.pm |
Statements | Executed 1272 statements in 3.65ms |
Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
---|---|---|---|---|---|
84 | 84 | 35 | 3.03ms | 5.36ms | import | Exporter::
8 | 3 | 1 | 1.66ms | 1.75ms | as_heavy | Exporter::
369 | 2 | 1 | 123µs | 123µs | CORE:subst (opcode) | Exporter::
208 | 2 | 1 | 107µs | 107µs | CORE:match (opcode) | Exporter::
6 | 2 | 2 | 35µs | 1.74ms | export | Exporter::
1 | 1 | 1 | 7µs | 32µs | export_tags | Exporter::
1 | 1 | 1 | 5µs | 19µs | export_to_level | Exporter::
0 | 0 | 0 | 0s | 0s | __ANON__[:64] | Exporter::
0 | 0 | 0 | 0s | 0s | export_fail | Exporter::
0 | 0 | 0 | 0s | 0s | export_ok_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 | 200ns | our $Debug = 0; | ||
10 | 1 | 100ns | our $ExportLevel = 0; | ||
11 | 1 | 200ns | our $Verbose ||= 0; | ||
12 | 1 | 200ns | our $VERSION = '5.73'; | ||
13 | our (%Cache); | ||||
14 | |||||
15 | sub as_heavy { | ||||
16 | 8 | 83µ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 | 8 | 25µs | my $c = (caller(1))[3]; | ||
20 | 8 | 55µs | 8 | 30µs | $c =~ s/.*:://; # spent 30µs making 8 calls to Exporter::CORE:subst, avg 4µs/call |
21 | 8 | 42µs | \&{"Exporter::Heavy::heavy_$c"}; | ||
22 | } | ||||
23 | |||||
24 | # spent 1.74ms (35µs+1.71) within Exporter::export which was called 6 times, avg 291µs/call:
# 5 times (31µs+1.70ms) by Exporter::import at line 62, avg 347µs/call
# once (5µs+6µs) by Exporter::Heavy::heavy_export_to_level at line 205 of Exporter/Heavy.pm | ||||
25 | 6 | 50µs | 12 | 2.27ms | goto &{as_heavy()}; # spent 1.71ms making 6 calls to Exporter::as_heavy, avg 285µs/call
# spent 558µs making 6 calls to Exporter::Heavy::heavy_export, avg 93µs/call |
26 | } | ||||
27 | |||||
28 | # spent 5.36ms (3.03+2.32) within Exporter::import which was called 84 times, avg 64µs/call:
# once (195µs+1.72ms) by Storable::BEGIN@72 at line 73 of Storable.pm
# once (227µs+13µs) by File::Temp::BEGIN@14 at line 14 of File/Temp.pm
# once (81µs+157µs) by Template::Parser::BEGIN@39 at line 39 of Template/Parser.pm
# once (34µs+142µs) by Getopt::Long::import at line 119 of Getopt/Long.pm
# once (135µs+1µs) by IO::CaptureOutput::_proxy::BEGIN@141 at line 141 of IO/CaptureOutput.pm
# once (21µs+80µs) by RBM::BEGIN@19 at line 19 of /root/tor-browser-build/rbm/lib/RBM.pm
# once (88µs+6µs) by RBM::BEGIN@21 at line 21 of /root/tor-browser-build/rbm/lib/RBM.pm
# once (87µs+5µs) by RBM::BEGIN@6 at line 6 of /root/tor-browser-build/rbm/lib/RBM.pm
# once (21µs+55µs) by RBM::BEGIN@20 at line 20 of /root/tor-browser-build/rbm/lib/RBM.pm
# once (60µs+4µs) by File::Temp::Dir::BEGIN@1541 at line 1541 of File/Temp.pm
# once (60µs+4µs) by IO::CaptureOutput::_proxy::BEGIN@138 at line 138 of IO/CaptureOutput.pm
# once (29µs+36µs) by IO::CaptureOutput::_proxy::BEGIN@139 at line 139 of IO/CaptureOutput.pm
# once (58µs+5µs) by RBM::BEGIN@15 at line 15 of /root/tor-browser-build/rbm/lib/RBM.pm
# once (52µs+4µs) by main::BEGIN@7 at line 7 of /root/tor-browser-build/rbm/rbm
# once (49µs+3µs) by RBM::BEGIN@23 at line 23 of /root/tor-browser-build/rbm/lib/RBM.pm
# once (50µs+2µs) by Template::VMethods::BEGIN@26 at line 26 of Template/VMethods.pm
# once (50µs+2µs) by RBM::BEGIN@22 at line 22 of /root/tor-browser-build/rbm/lib/RBM.pm
# once (50µs+2µs) by RBM::DefaultConfig::BEGIN@16 at line 16 of /root/tor-browser-build/rbm/lib/RBM/DefaultConfig.pm
# once (47µs+2µs) by Template::Stash::BEGIN@26 at line 26 of Template/Stash.pm
# once (44µs+2µs) by RBM::BEGIN@13 at line 13 of /root/tor-browser-build/rbm/lib/RBM.pm
# once (43µs+3µs) by YAML::XS::BEGIN@21 at line 21 of YAML/XS.pm
# once (44µs+2µs) by RBM::BEGIN@14 at line 14 of /root/tor-browser-build/rbm/lib/RBM.pm
# once (44µs+0s) by Template::Iterator::BEGIN@27 at line 27 of Template/Iterator.pm
# once (40µs+3µs) by IO::CaptureOutput::BEGIN@11 at line 11 of IO/CaptureOutput.pm
# once (41µs+2µs) by RBM::BEGIN@5 at line 5 of /root/tor-browser-build/rbm/lib/RBM.pm
# once (40µs+2µs) by RBM::BEGIN@18 at line 18 of /root/tor-browser-build/rbm/lib/RBM.pm
# once (40µs+2µs) by Template::Provider::BEGIN@47 at line 47 of Template/Provider.pm
# once (38µs+2µs) by RBM::BEGIN@2.7 at line 2 of (eval 14)[rbm/lib/RBM.pm:39]
# once (35µs+4µs) by IO::CaptureOutput::_proxy::BEGIN@140 at line 140 of IO/CaptureOutput.pm
# once (34µs+3µs) by RBM::BEGIN@7 at line 7 of /root/tor-browser-build/rbm/lib/RBM.pm
# once (35µs+2µs) by Template::Iterator::BEGIN@29 at line 29 of Template/Iterator.pm
# once (35µs+1µs) by Encode::BEGIN@55 at line 55 of Encode.pm
# once (33µs+2µs) by Template::Context::BEGIN@31 at line 31 of Template/Context.pm
# once (35µs+0s) by Template::Context::BEGIN@29 at line 29 of Template/Context.pm
# once (33µs+1µs) by IO::Handle::BEGIN@5 at line 5 of IO/Handle.pm
# once (33µs+2µs) by RBM::DefaultConfig::BEGIN@12 at line 12 of /root/tor-browser-build/rbm/lib/RBM/DefaultConfig.pm
# once (32µs+2µs) by Template::BEGIN@31 at line 31 of Template.pm
# once (31µs+2µs) by RBM::BEGIN@12 at line 12 of /root/tor-browser-build/rbm/lib/RBM.pm
# once (32µs+2µs) by main::BEGIN@4 at line 4 of /root/tor-browser-build/rbm/rbm
# once (31µs+2µs) by YAML::XS::BEGIN@20 at line 20 of YAML/XS.pm
# once (31µs+2µs) by RBM::BEGIN@10 at line 10 of /root/tor-browser-build/rbm/lib/RBM.pm
# once (31µs+1µs) by File::Copy::Recursive::BEGIN@11 at line 11 of File/Copy/Recursive.pm
# once (30µs+2µs) by Template::BEGIN@32 at line 32 of Template.pm
# once (29µs+2µs) by IO::Handle::BEGIN@6 at line 6 of IO/Handle.pm
# once (30µs+1µs) by Data::UUID::BEGIN@5 at line 5 of Data/UUID.pm
# once (28µs+3µs) by File::Temp::BEGIN@13 at line 13 of File/Temp.pm
# once (28µs+2µs) by File::Temp::BEGIN@10 at line 10 of File/Temp.pm
# once (28µs+2µs) by Template::Filters::BEGIN@27 at line 27 of Template/Filters.pm
# once (27µs+2µs) by RBM::BEGIN@8 at line 8 of /root/tor-browser-build/rbm/lib/RBM.pm
# once (27µs+1µs) by RBM::BEGIN@17 at line 17 of /root/tor-browser-build/rbm/lib/RBM.pm
# once (25µs+2µs) by IO::Seekable::BEGIN@6 at line 6 of IO/Seekable.pm
# once (26µs+800ns) by Digest::SHA::BEGIN@8 at line 8 of Digest/SHA.pm
# once (26µs+0s) by Template::Service::BEGIN@28 at line 28 of Template/Service.pm
# once (24µs+2µs) by Template::Service::BEGIN@29 at line 29 of Template/Service.pm
# once (24µs+1µs) by IO::BEGIN@6 at line 6 of IO.pm
# once (24µs+1µs) by SelectSaver::BEGIN@6 at line 6 of SelectSaver.pm
# once (22µs+1µs) by File::Temp::BEGIN@15 at line 15 of File/Temp.pm
# once (24µs+0s) by Template::Plugins::BEGIN@29 at line 29 of Template/Plugins.pm
# once (22µs+1µs) by RBM::BEGIN@28 at line 28 of (eval 14)[rbm/lib/RBM.pm:39]
# once (22µs+0s) by RBM::BEGIN@11 at line 11 of /root/tor-browser-build/rbm/lib/RBM.pm
# once (21µs+1µs) by SelectSaver::BEGIN@7 at line 7 of SelectSaver.pm
# once (20µs+1µs) by IO::Seekable::BEGIN@11 at line 11 of IO/Seekable.pm
# once (19µs+1µs) by File::Path::BEGIN@6 at line 6 of File/Path.pm
# once (20µs+700ns) by RBM::DefaultConfig::BEGIN@14 at line 14 of /root/tor-browser-build/rbm/lib/RBM/DefaultConfig.pm
# once (19µs+800ns) by Template::BEGIN@33 at line 33 of Template.pm
# once (18µs+700ns) by RBM::BEGIN@16 at line 16 of /root/tor-browser-build/rbm/lib/RBM.pm
# once (18µs+1µs) by File::Temp::BEGIN@17 at line 17 of File/Temp.pm
# once (17µs+800ns) by File::Copy::Recursive::BEGIN@12 at line 12 of File/Copy/Recursive.pm
# once (17µs+600ns) by RBM::DefaultConfig::BEGIN@15 at line 15 of /root/tor-browser-build/rbm/lib/RBM/DefaultConfig.pm
# once (17µs+0s) by Cwd::BEGIN@3 at line 3 of Cwd.pm
# once (16µs+0s) by Template::Directive::BEGIN@32 at line 32 of Template/Directive.pm
# once (16µs+0s) by Template::Constants::BEGIN@24 at line 24 of Template/Constants.pm
# once (15µs+0s) by Template::Filters::BEGIN@26 at line 26 of Template/Filters.pm
# once (15µs+0s) by Template::Base::BEGIN@24 at line 24 of Template/Base.pm
# once (14µs+0s) by File::Temp::BEGIN@16 at line 16 of File/Temp.pm
# once (13µs+0s) by Template::BEGIN@28 at line 28 of Template.pm
# once (13µs+0s) by Getopt::Long::BEGIN@26 at line 26 of Getopt/Long.pm
# once (12µs+0s) by IO::CaptureOutput::BEGIN@10 at line 10 of IO/CaptureOutput.pm
# once (10µs+0s) by Template::Provider::BEGIN@45 at line 45 of Template/Provider.pm
# once (10µs+0s) by Template::Document::BEGIN@27 at line 27 of Template/Document.pm
# once (6µs+0s) by File::Temp::BEGIN@43 at line 43 of File/Temp.pm
# once (6µs+0s) by Encode::BEGIN@15 at line 15 of Encode.pm
# once (6µs+0s) by Path::Tiny::BEGIN@12 at line 12 of Path/Tiny.pm
# once (5µs+0s) by Encode::Alias::BEGIN@7 at line 7 of Encode/Alias.pm | ||||
29 | 84 | 35µs | my $pkg = shift; | ||
30 | 84 | 71µs | my $callpkg = caller($ExportLevel); | ||
31 | |||||
32 | 84 | 31µs | if ($pkg eq "Exporter" and @_ and $_[0] eq "import") { | ||
33 | 4 | 11µs | *{$callpkg."::import"} = \&import; | ||
34 | 4 | 18µs | return; | ||
35 | } | ||||
36 | |||||
37 | # We *need* to treat @{"$pkg\::EXPORT_FAIL"} since Carp uses it :-( | ||||
38 | 80 | 264µ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 | 80 | 110µs | my $fail = ${$pkg . '::'}{EXPORT_FAIL} && \@{"$pkg\::EXPORT_FAIL"}; | ||
42 | 80 | 62µs | return export $pkg, $callpkg, @_ | ||
43 | if $Verbose or $Debug or $fail && @$fail > 1; | ||||
44 | 80 | 80µs | my $export_cache = ($Cache{$pkg} ||= {}); | ||
45 | 80 | 90µs | my $args = @_ or @_ = @$exports; | ||
46 | |||||
47 | 80 | 28µs | if ($args and not %$export_cache) { | ||
48 | s/^&//, $export_cache->{$_} = 1 | ||||
49 | 16 | 610µs | 361 | 93µs | foreach (@$exports, @{"$pkg\::EXPORT_OK"}); # spent 93µs making 361 calls to Exporter::CORE:subst, avg 257ns/call |
50 | } | ||||
51 | 80 | 13µ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 | 80 | 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 | 43 | 368µs | 133 | 65µs | foreach (@_); # spent 65µs making 133 calls to Exporter::CORE:match, avg 492ns/call |
58 | } else { | ||||
59 | ($heavy = /\W/) and last | ||||
60 | 37 | 217µs | 75 | 42µs | foreach (@_); # spent 42µs making 75 calls to Exporter::CORE:match, avg 555ns/call |
61 | } | ||||
62 | 80 | 40µs | 5 | 1.73ms | return export $pkg, $callpkg, ($args ? @_ : ()) if $heavy; # spent 1.73ms making 5 calls to Exporter::export, avg 347µs/call |
63 | local $SIG{__WARN__} = | ||||
64 | 75 | 305µs | sub {require Carp; &Carp::carp} if not $SIG{__WARN__}; | ||
65 | # shortcut for the common case of no type character | ||||
66 | 75 | 980µ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 19µs (5+14) within Exporter::export_to_level which was called:
# once (5µs+14µs) by Time::HiRes::import at line 91 of Time/HiRes.pm | ||||
81 | 1 | 7µs | 2 | 208µs | goto &{as_heavy()}; # spent 194µs making 1 call to Exporter::Heavy::heavy_export_to_level
# spent 14µs making 1 call to Exporter::as_heavy |
82 | } | ||||
83 | |||||
84 | # spent 32µs (7+25) within Exporter::export_tags which was called:
# once (7µs+25µs) by IO::CaptureOutput::_proxy::BEGIN@138 at line 72 of File/Temp.pm | ||||
85 | 1 | 8µs | 2 | 49µs | goto &{as_heavy()}; # spent 25µs making 1 call to Exporter::as_heavy
# spent 24µs making 1 call to Exporter::Heavy::heavy_export_tags |
86 | } | ||||
87 | |||||
88 | sub export_ok_tags { | ||||
89 | goto &{as_heavy()}; | ||||
90 | } | ||||
91 | |||||
92 | sub require_version { | ||||
93 | goto &{as_heavy()}; | ||||
94 | } | ||||
95 | |||||
96 | 1 | 4µs | 1; | ||
97 | __END__ | ||||
sub Exporter::CORE:match; # opcode | |||||
sub Exporter::CORE:subst; # opcode |