Filename | /usr/share/perl/5.28/Exporter.pm |
Statements | Executed 1272 statements in 3.76ms |
Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
---|---|---|---|---|---|
84 | 84 | 35 | 3.15ms | 5.31ms | import | Exporter::
8 | 3 | 1 | 1.59ms | 1.68ms | as_heavy | Exporter::
208 | 2 | 1 | 106µs | 106µs | CORE:match (opcode) | Exporter::
369 | 2 | 1 | 83µs | 83µs | CORE:subst (opcode) | Exporter::
6 | 2 | 2 | 33µs | 1.67ms | export | Exporter::
1 | 1 | 1 | 7µs | 27µs | export_to_level | Exporter::
1 | 1 | 1 | 6µs | 29µs | export_tags | 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 | 9µ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 | 113µ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 | 58µs | 8 | 28µs | $c =~ s/.*:://; # spent 28µs making 8 calls to Exporter::CORE:subst, avg 4µs/call |
21 | 8 | 48µs | \&{"Exporter::Heavy::heavy_$c"}; | ||
22 | } | ||||
23 | |||||
24 | # spent 1.67ms (33µs+1.64) within Exporter::export which was called 6 times, avg 278µs/call:
# 5 times (29µs+1.63ms) by Exporter::import at line 62, avg 332µs/call
# once (4µs+6µs) by Exporter::Heavy::heavy_export_to_level at line 205 of Exporter/Heavy.pm | ||||
25 | 6 | 42µs | 12 | 2.15ms | goto &{as_heavy()}; # spent 1.64ms making 6 calls to Exporter::as_heavy, avg 273µs/call
# spent 517µs making 6 calls to Exporter::Heavy::heavy_export, avg 86µs/call |
26 | } | ||||
27 | |||||
28 | # spent 5.31ms (3.15+2.17) within Exporter::import which was called 84 times, avg 63µs/call:
# once (235µs+1.65ms) by Storable::BEGIN@72 at line 73 of Storable.pm
# once (260µs+12µs) by File::Temp::BEGIN@14 at line 14 of File/Temp.pm
# once (88µs+149µs) by Template::Parser::BEGIN@39 at line 39 of Template/Parser.pm
# once (30µs+98µs) by Getopt::Long::import at line 119 of Getopt/Long.pm
# once (29µs+92µs) by RBM::BEGIN@19 at line 19 of /root/tor-browser-build/rbm/lib/RBM.pm
# once (109µs+6µs) by RBM::BEGIN@6 at line 6 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 (82µs+700ns) by File::Copy::Recursive::BEGIN@12 at line 12 of File/Copy/Recursive.pm
# once (19µs+49µs) by RBM::BEGIN@20 at line 20 of /root/tor-browser-build/rbm/lib/RBM.pm
# once (64µs+3µs) by RBM::BEGIN@23 at line 23 of /root/tor-browser-build/rbm/lib/RBM.pm
# once (60µs+4µs) by IO::CaptureOutput::_proxy::BEGIN@138 at line 138 of IO/CaptureOutput.pm
# once (56µs+3µs) by File::Temp::Dir::BEGIN@1541 at line 1541 of File/Temp.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 (48µs+3µs) by RBM::BEGIN@15 at line 15 of /root/tor-browser-build/rbm/lib/RBM.pm
# once (47µs+2µs) by main::BEGIN@7 at line 7 of /root/tor-browser-build/rbm/rbm
# once (48µs+2µs) by RBM::BEGIN@14 at line 14 of /root/tor-browser-build/rbm/lib/RBM.pm
# once (45µs+2µs) by Template::VMethods::BEGIN@26 at line 26 of Template/VMethods.pm
# once (44µs+2µs) by RBM::BEGIN@13 at line 13 of /root/tor-browser-build/rbm/lib/RBM.pm
# once (44µs+2µs) by YAML::XS::BEGIN@20 at line 20 of YAML/XS.pm
# once (41µs+4µs) by Template::Provider::BEGIN@47 at line 47 of Template/Provider.pm
# once (42µs+2µs) by YAML::XS::BEGIN@21 at line 21 of YAML/XS.pm
# once (44µs+0s) by Template::Iterator::BEGIN@27 at line 27 of Template/Iterator.pm
# once (39µs+3µs) by IO::CaptureOutput::BEGIN@11 at line 11 of IO/CaptureOutput.pm
# once (38µs+2µs) by RBM::BEGIN@2.7 at line 2 of (eval 14)[rbm/lib/RBM.pm:39]
# once (38µs+3µs) by RBM::BEGIN@22 at line 22 of /root/tor-browser-build/rbm/lib/RBM.pm
# once (38µs+2µs) by File::Copy::Recursive::BEGIN@11 at line 11 of File/Copy/Recursive.pm
# once (37µs+2µs) by Template::BEGIN@31 at line 31 of Template.pm
# once (39µs+0s) by Getopt::Long::BEGIN@26 at line 26 of Getopt/Long.pm
# once (37µs+2µs) by Template::BEGIN@32 at line 32 of Template.pm
# once (37µs+2µs) by RBM::BEGIN@18 at line 18 of /root/tor-browser-build/rbm/lib/RBM.pm
# once (36µs+2µs) by RBM::DefaultConfig::BEGIN@12 at line 12 of /root/tor-browser-build/rbm/lib/RBM/DefaultConfig.pm
# once (36µs+2µs) by RBM::BEGIN@5 at line 5 of /root/tor-browser-build/rbm/lib/RBM.pm
# once (33µs+4µs) by IO::CaptureOutput::_proxy::BEGIN@140 at line 140 of IO/CaptureOutput.pm
# once (35µs+1µs) by Encode::BEGIN@55 at line 55 of Encode.pm
# once (34µs+1µs) by IO::Handle::BEGIN@5 at line 5 of IO/Handle.pm
# once (32µs+3µs) by Template::Iterator::BEGIN@29 at line 29 of Template/Iterator.pm
# once (33µs+2µs) by RBM::BEGIN@7 at line 7 of /root/tor-browser-build/rbm/lib/RBM.pm
# once (32µs+1µs) by Template::Stash::BEGIN@26 at line 26 of Template/Stash.pm
# once (32µs+2µs) by RBM::BEGIN@10 at line 10 of /root/tor-browser-build/rbm/lib/RBM.pm
# once (32µs+2µs) by IO::Handle::BEGIN@6 at line 6 of IO/Handle.pm
# once (32µs+2µs) by main::BEGIN@4 at line 4 of /root/tor-browser-build/rbm/rbm
# once (31µs+1µs) by Data::UUID::BEGIN@5 at line 5 of Data/UUID.pm
# once (31µs+2µs) by RBM::BEGIN@8 at line 8 of /root/tor-browser-build/rbm/lib/RBM.pm
# once (31µs+800ns) by Digest::SHA::BEGIN@8 at line 8 of Digest/SHA.pm
# once (29µs+2µs) by File::Temp::BEGIN@13 at line 13 of File/Temp.pm
# once (28µs+2µs) by RBM::BEGIN@12 at line 12 of /root/tor-browser-build/rbm/lib/RBM.pm
# once (28µs+2µs) by Template::Context::BEGIN@31 at line 31 of Template/Context.pm
# once (28µs+900ns) by IO::CaptureOutput::_proxy::BEGIN@141 at line 141 of IO/CaptureOutput.pm
# once (27µs+2µs) by IO::CaptureOutput::_proxy::BEGIN@139 at line 139 of IO/CaptureOutput.pm
# once (27µs+2µs) by Template::Filters::BEGIN@27 at line 27 of Template/Filters.pm
# once (28µs+0s) by Template::Service::BEGIN@28 at line 28 of Template/Service.pm
# once (26µs+1µs) by Template::Service::BEGIN@29 at line 29 of Template/Service.pm
# once (27µs+0s) by Template::Context::BEGIN@29 at line 29 of Template/Context.pm
# once (25µs+1µs) by SelectSaver::BEGIN@6 at line 6 of SelectSaver.pm
# once (25µs+1µs) by RBM::BEGIN@17 at line 17 of /root/tor-browser-build/rbm/lib/RBM.pm
# once (25µs+1µs) by IO::BEGIN@6 at line 6 of IO.pm
# once (25µs+1µs) by File::Temp::BEGIN@10 at line 10 of File/Temp.pm
# once (25µs+1µs) by IO::Seekable::BEGIN@6 at line 6 of IO/Seekable.pm
# once (25µs+0s) by Template::Base::BEGIN@24 at line 24 of Template/Base.pm
# once (22µs+1µs) by RBM::BEGIN@28 at line 28 of (eval 14)[rbm/lib/RBM.pm:39]
# once (23µs+0s) by Template::Plugins::BEGIN@29 at line 29 of Template/Plugins.pm
# once (22µs+700ns) by Template::BEGIN@33 at line 33 of Template.pm
# once (22µs+1µs) by File::Temp::BEGIN@15 at line 15 of File/Temp.pm
# once (23µs+0s) by Cwd::BEGIN@3 at line 3 of Cwd.pm
# once (21µs+1µs) by SelectSaver::BEGIN@7 at line 7 of SelectSaver.pm
# once (21µs+1µs) by IO::Seekable::BEGIN@11 at line 11 of IO/Seekable.pm
# once (21µs+1µs) by File::Path::BEGIN@6 at line 6 of File/Path.pm
# once (21µs+800ns) by RBM::DefaultConfig::BEGIN@14 at line 14 of /root/tor-browser-build/rbm/lib/RBM/DefaultConfig.pm
# once (20µs+0s) by Template::Constants::BEGIN@24 at line 24 of Template/Constants.pm
# once (19µs+0s) by Template::BEGIN@28 at line 28 of Template.pm
# once (18µs+1µs) by File::Temp::BEGIN@17 at line 17 of File/Temp.pm
# once (18µs+700ns) by RBM::BEGIN@16 at line 16 of /root/tor-browser-build/rbm/lib/RBM.pm
# once (18µs+0s) by Template::Filters::BEGIN@26 at line 26 of Template/Filters.pm
# once (18µs+0s) by RBM::BEGIN@11 at line 11 of /root/tor-browser-build/rbm/lib/RBM.pm
# once (16µs+500ns) by RBM::DefaultConfig::BEGIN@15 at line 15 of /root/tor-browser-build/rbm/lib/RBM/DefaultConfig.pm
# once (16µs+0s) by Template::Directive::BEGIN@32 at line 32 of Template/Directive.pm
# once (14µs+0s) by File::Temp::BEGIN@16 at line 16 of File/Temp.pm
# once (13µs+0s) by Template::Provider::BEGIN@45 at line 45 of Template/Provider.pm
# once (13µs+0s) by Template::Document::BEGIN@27 at line 27 of Template/Document.pm
# once (12µs+0s) by IO::CaptureOutput::BEGIN@10 at line 10 of IO/CaptureOutput.pm
# once (7µs+0s) by Path::Tiny::BEGIN@12 at line 12 of Path/Tiny.pm
# once (6µs+0s) by Encode::BEGIN@15 at line 15 of Encode.pm
# once (5µs+0s) by File::Temp::BEGIN@43 at line 43 of File/Temp.pm
# once (5µs+0s) by Encode::Alias::BEGIN@7 at line 7 of Encode/Alias.pm | ||||
29 | 84 | 33µs | my $pkg = shift; | ||
30 | 84 | 57µs | my $callpkg = caller($ExportLevel); | ||
31 | |||||
32 | 84 | 33µs | if ($pkg eq "Exporter" and @_ and $_[0] eq "import") { | ||
33 | 4 | 10µs | *{$callpkg."::import"} = \&import; | ||
34 | 4 | 10µs | return; | ||
35 | } | ||||
36 | |||||
37 | # We *need* to treat @{"$pkg\::EXPORT_FAIL"} since Carp uses it :-( | ||||
38 | 80 | 167µ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 | 126µs | my $fail = ${$pkg . '::'}{EXPORT_FAIL} && \@{"$pkg\::EXPORT_FAIL"}; | ||
42 | 80 | 53µs | return export $pkg, $callpkg, @_ | ||
43 | if $Verbose or $Debug or $fail && @$fail > 1; | ||||
44 | 80 | 87µs | my $export_cache = ($Cache{$pkg} ||= {}); | ||
45 | 80 | 110µs | my $args = @_ or @_ = @$exports; | ||
46 | |||||
47 | 80 | 31µs | if ($args and not %$export_cache) { | ||
48 | s/^&//, $export_cache->{$_} = 1 | ||||
49 | 16 | 609µs | 361 | 55µs | foreach (@$exports, @{"$pkg\::EXPORT_OK"}); # spent 55µs making 361 calls to Exporter::CORE:subst, avg 152ns/call |
50 | } | ||||
51 | 80 | 14µ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 | 44µ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 | 430µs | 133 | 63µs | foreach (@_); # spent 63µs making 133 calls to Exporter::CORE:match, avg 474ns/call |
58 | } else { | ||||
59 | ($heavy = /\W/) and last | ||||
60 | 37 | 204µs | 75 | 43µs | foreach (@_); # spent 43µs making 75 calls to Exporter::CORE:match, avg 568ns/call |
61 | } | ||||
62 | 80 | 54µs | 5 | 1.66ms | return export $pkg, $callpkg, ($args ? @_ : ()) if $heavy; # spent 1.66ms making 5 calls to Exporter::export, avg 332µs/call |
63 | local $SIG{__WARN__} = | ||||
64 | 75 | 278µs | sub {require Carp; &Carp::carp} if not $SIG{__WARN__}; | ||
65 | # shortcut for the common case of no type character | ||||
66 | 75 | 1.09ms | *{"$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 27µs (7+20) within Exporter::export_to_level which was called:
# once (7µs+20µs) by Time::HiRes::import at line 91 of Time/HiRes.pm | ||||
81 | 1 | 8µs | 2 | 216µs | goto &{as_heavy()}; # spent 195µs making 1 call to Exporter::Heavy::heavy_export_to_level
# spent 20µs making 1 call to Exporter::as_heavy |
82 | } | ||||
83 | |||||
84 | # spent 29µs (6+23) within Exporter::export_tags which was called:
# once (6µs+23µs) by IO::CaptureOutput::_proxy::BEGIN@138 at line 72 of File/Temp.pm | ||||
85 | 1 | 8µs | 2 | 46µs | goto &{as_heavy()}; # spent 23µs making 1 call to Exporter::as_heavy
# spent 22µ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 |