Filename | /home/hinrik/perl5/perlbrew/perls/perl-5.13.5/lib/5.13.5/Exporter.pm |
Statements | Executed 1298 statements in 6.42ms |
Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
---|---|---|---|---|---|
75 | 75 | 43 | 4.84ms | 9.57ms | import | Exporter::
25 | 3 | 1 | 1.68ms | 1.87ms | as_heavy | Exporter::
475 | 2 | 1 | 565µs | 565µs | CORE:subst (opcode) | Exporter::
93 | 2 | 1 | 162µs | 162µs | CORE:match (opcode) | Exporter::
22 | 2 | 2 | 150µs | 1.95ms | export | Exporter::
2 | 1 | 1 | 16µs | 57µs | export_to_level | Exporter::
1 | 1 | 1 | 11µs | 44µs | export_ok_tags | Exporter::
0 | 0 | 0 | 0s | 0s | __ANON__[:65] | 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 | 19µs | require 5.006; | ||
4 | |||||
5 | # Be lean. | ||||
6 | #use strict; | ||||
7 | #no strict 'refs'; | ||||
8 | |||||
9 | 1 | 1µs | our $Debug = 0; | ||
10 | 1 | 1µs | our $ExportLevel = 0; | ||
11 | 1 | 1µs | our $Verbose ||= 0; | ||
12 | 1 | 1µs | our $VERSION = '5.64_03'; | ||
13 | 1 | 1µs | our (%Cache); | ||
14 | |||||
15 | # spent 1.87ms (1.68+187µs) within Exporter::as_heavy which was called 25 times, avg 75µs/call:
# 22 times (1.63ms+170µs) by Exporter::export at line 25, avg 82µs/call
# 2 times (33µs+9µs) by Exporter::export_to_level at line 82, avg 21µs/call
# once (25µs+8µs) by Exporter::export_ok_tags at line 90 | ||||
16 | 25 | 180µ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 | 25 | 78µs | my $c = (caller(1))[3]; | ||
20 | 25 | 172µs | 25 | 78µs | $c =~ s/.*:://; # spent 78µs making 25 calls to Exporter::CORE:subst, avg 3µs/call |
21 | 25 | 137µs | \&{"Exporter::Heavy::heavy_$c"}; | ||
22 | } | ||||
23 | |||||
24 | # spent 1.95ms (150µs+1.80) within Exporter::export which was called 22 times, avg 88µs/call:
# 20 times (136µs+1.77ms) by Exporter::import at line 63, avg 95µs/call
# 2 times (14µs+26µs) by Exporter::Heavy::heavy_export_to_level at line 214 of Exporter/Heavy.pm, avg 20µs/call | ||||
25 | 22 | 191µs | 44 | 4.30ms | goto &{as_heavy()}; # spent 2.50ms making 22 calls to Exporter::Heavy::heavy_export, avg 114µs/call
# spent 1.80ms making 22 calls to Exporter::as_heavy, avg 82µs/call |
26 | } | ||||
27 | |||||
28 | # spent 9.57ms (4.84+4.72) within Exporter::import which was called 75 times, avg 128µs/call:
# once (46µs+1.60ms) by Getopt::Long::import at line 113 of Getopt/Long.pm
# once (492µs+304µs) by Term::Sk::BEGIN@7 at line 7 of Term/Sk.pm
# once (101µs+303µs) by Getopt::Long::Descriptive::BEGIN@9 at line 9 of Getopt/Long/Descriptive.pm
# once (178µs+163µs) by Regexp::Common::URI::RFC2806::BEGIN@4 at line 4 of Regexp/Common/URI/RFC2806.pm
# once (178µs+156µs) by Regexp::Common::URI::file::BEGIN@5 at line 5 of Regexp/Common/URI/file.pm
# once (167µs+139µs) by Regexp::Common::URI::gopher::BEGIN@6 at line 6 of Regexp/Common/URI/gopher.pm
# once (165µs+137µs) by Regexp::Common::URI::fax::BEGIN@5 at line 5 of Regexp/Common/URI/fax.pm
# once (199µs+39µs) by hailo::BEGIN@7 at line 7 of bin/hailo
# once (36µs+177µs) by Regexp::Common::URI::wais::BEGIN@5 at line 5 of Regexp/Common/URI/wais.pm
# once (75µs+129µs) by Regexp::Common::URI::RFC2806::BEGIN@3 at line 3 of Regexp/Common/URI/RFC2806.pm
# once (34µs+168µs) by Regexp::Common::URI::prospero::BEGIN@5 at line 5 of Regexp/Common/URI/prospero.pm
# once (31µs+169µs) by Regexp::Common::URI::news::BEGIN@5 at line 5 of Regexp/Common/URI/news.pm
# once (81µs+113µs) by Regexp::Common::URI::pop::BEGIN@6 at line 6 of Regexp/Common/URI/pop.pm
# once (33µs+147µs) by Regexp::Common::URI::ftp::BEGIN@5 at line 5 of Regexp/Common/URI/ftp.pm
# once (34µs+145µs) by Regexp::Common::URI::http::BEGIN@5 at line 5 of Regexp/Common/URI/http.pm
# once (142µs+33µs) by Hailo::Engine::Default::BEGIN@6 at line 6 of lib/Hailo/Engine/Default.pm
# once (32µs+137µs) by Regexp::Common::URI::telnet::BEGIN@5 at line 5 of Regexp/Common/URI/telnet.pm
# once (32µs+118µs) by Regexp::Common::URI::gopher::BEGIN@5 at line 5 of Regexp/Common/URI/gopher.pm
# once (32µs+117µs) by Regexp::Common::URI::RFC2384::BEGIN@5 at line 5 of Regexp/Common/URI/RFC2384.pm
# once (31µs+101µs) by Regexp::Common::URI::tel::BEGIN@5 at line 5 of Regexp/Common/URI/tel.pm
# once (32µs+96µs) by Regexp::Common::URI::pop::BEGIN@5 at line 5 of Regexp/Common/URI/pop.pm
# once (31µs+80µs) by Regexp::Common::URI::tv::BEGIN@8 at line 8 of Regexp/Common/URI/tv.pm
# once (84µs+15µs) by Mouse::BEGIN@9 at line 9 of Mouse.pm
# once (86µs+11µs) by Mouse::BEGIN@8 at line 8 of Mouse.pm
# once (84µs+6µs) by Encode::BEGIN@48 at line 48 of Encode.pm
# once (77µs+10µs) by Getopt::Long::Descriptive::BEGIN@8 at line 8 of Getopt/Long/Descriptive.pm
# once (73µs+4µs) by IO::Interactive::BEGIN@7 at line 7 of IO/Interactive.pm
# once (67µs+5µs) by Sub::Install::BEGIN@6 at line 6 of Sub/Install.pm
# once (68µs+4µs) by Regexp::Common::URI::fax::BEGIN@4 at line 4 of Regexp/Common/URI/fax.pm
# once (67µs+5µs) by Fatal::BEGIN@4 at line 4 of Fatal.pm
# once (64µs+5µs) by namespace::clean::BEGIN@14 at line 14 of namespace/clean.pm
# once (67µs+2µs) by IO::Interactive::BEGIN@8 at line 8 of IO/Interactive.pm
# once (62µs+7µs) by namespace::clean::BEGIN@15 at line 15 of namespace/clean.pm
# once (62µs+5µs) by IO::Handle::BEGIN@264 at line 264 of IO/Handle.pm
# once (62µs+4µs) by Hailo::Engine::Default::BEGIN@5 at line 5 of lib/Hailo/Engine/Default.pm
# once (61µs+5µs) by Hailo::Command::__ANON__[lib/Hailo/Command.pm:307] at line 303 of lib/Hailo/Command.pm
# once (60µs+3µs) by Getopt::Long::Descriptive::Opts::BEGIN@5 at line 5 of Getopt/Long/Descriptive/Opts.pm
# once (57µs+4µs) by IO::Handle::BEGIN@263 at line 263 of IO/Handle.pm
# once (55µs+5µs) by SelectSaver::BEGIN@39 at line 39 of SelectSaver.pm
# once (55µs+4µs) by SelectSaver::BEGIN@38 at line 38 of SelectSaver.pm
# once (55µs+4µs) by Tie::Hash::BEGIN@188 at line 188 of Tie/Hash.pm
# once (54µs+4µs) by IO::BEGIN@6 at line 6 of IO.pm
# once (53µs+4µs) by IO::Interactive::BEGIN@115 at line 115 of IO/Interactive.pm
# once (52µs+3µs) by Getopt::Long::Descriptive::BEGIN@5 at line 5 of Getopt/Long/Descriptive.pm
# once (53µs+0s) by Hailo::Storage::BEGIN@6 at line 6 of lib/Hailo/Storage.pm
# once (49µs+2µs) by Hailo::BEGIN@7 at line 7 of lib/Hailo.pm
# once (47µs+2µs) by Regexp::Common::URI::file::BEGIN@4 at line 4 of Regexp/Common/URI/file.pm
# once (46µs+2µs) by Hailo::Tokenizer::Words::BEGIN@8 at line 8 of lib/Hailo/Tokenizer/Words.pm
# once (45µs+2µs) by File::CountLines::BEGIN@11 at line 11 of File/CountLines.pm
# once (43µs+2µs) by Regexp::Common::URI::wais::BEGIN@4 at line 4 of Regexp/Common/URI/wais.pm
# once (42µs+2µs) by Mouse::Role::BEGIN@6 at line 6 of Mouse/Role.pm
# once (42µs+2µs) by Regexp::Common::URI::http::BEGIN@4 at line 4 of Regexp/Common/URI/http.pm
# once (42µs+2µs) by Tie::RefHash::BEGIN@106 at line 111 of Tie/RefHash.pm
# once (42µs+2µs) by Regexp::Common::URI::telnet::BEGIN@4 at line 4 of Regexp/Common/URI/telnet.pm
# once (42µs+2µs) by Regexp::Common::URI::gopher::BEGIN@4 at line 4 of Regexp/Common/URI/gopher.pm
# once (42µs+2µs) by Regexp::Common::URI::prospero::BEGIN@4 at line 4 of Regexp/Common/URI/prospero.pm
# once (41µs+2µs) by Package::Stash::BEGIN@9 at line 9 of Package/Stash.pm
# once (41µs+2µs) by Regexp::Common::URI::ftp::BEGIN@4 at line 4 of Regexp/Common/URI/ftp.pm
# once (41µs+2µs) by Getopt::Long::Descriptive::Usage::BEGIN@7 at line 7 of Getopt/Long/Descriptive/Usage.pm
# once (41µs+2µs) by Tie::RefHash::BEGIN@94 at line 94 of Tie/RefHash.pm
# once (41µs+2µs) by Regexp::Common::URI::tv::BEGIN@7 at line 7 of Regexp/Common/URI/tv.pm
# once (41µs+2µs) by Regexp::Common::URI::news::BEGIN@4 at line 4 of Regexp/Common/URI/news.pm
# once (41µs+2µs) by Regexp::Common::URI::tel::BEGIN@4 at line 4 of Regexp/Common/URI/tel.pm
# once (41µs+1µs) by Package::Stash::BEGIN@10 at line 10 of Package/Stash.pm
# once (41µs+1µs) by Regexp::Common::URI::pop::BEGIN@4 at line 4 of Regexp/Common/URI/pop.pm
# once (40µs+2µs) by Mouse::Role::BEGIN@7 at line 7 of Mouse/Role.pm
# once (40µs+2µs) by Hailo::BEGIN@8 at line 8 of lib/Hailo.pm
# once (39µs+0s) by Cwd::BEGIN@171 at line 171 of Cwd.pm
# once (36µs+0s) by IO::Interactive::BEGIN@76 at line 76 of IO/Interactive.pm
# once (35µs+0s) by File::CountLines::BEGIN@8 at line 8 of File/CountLines.pm
# once (34µs+0s) by Getopt::Long::BEGIN@25 at line 25 of Getopt/Long.pm
# once (33µs+0s) by B::Hooks::EndOfScope::BEGIN@14 at line 14 of B/Hooks/EndOfScope.pm
# once (33µs+0s) by Params::Validate::BEGIN@6 at line 6 of Params/Validate.pm
# once (31µs+0s) by Sub::Identify::BEGIN@4 at line 4 of Sub/Identify.pm
# once (14µs+0s) by Hailo::Command::__ANON__[lib/Hailo/Command.pm:307] at line 9 of File/CountLines.pm | ||||
29 | 75 | 115µs | my $pkg = shift; | ||
30 | 75 | 114µs | my $callpkg = caller($ExportLevel); | ||
31 | |||||
32 | 75 | 95µs | if ($pkg eq "Exporter" and @_ and $_[0] eq "import") { | ||
33 | 1 | 5µs | *{$callpkg."::import"} = \&import; | ||
34 | 1 | 6µs | return; | ||
35 | } | ||||
36 | |||||
37 | # We *need* to treat @{"$pkg\::EXPORT_FAIL"} since Carp uses it :-( | ||||
38 | 74 | 208µ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 | 74 | 190µs | my $fail = ${$pkg . '::'}{EXPORT_FAIL} && \@{"$pkg\::EXPORT_FAIL"}; | ||
42 | 74 | 103µs | return export $pkg, $callpkg, @_ | ||
43 | if $Verbose or $Debug or $fail && @$fail > 1; | ||||
44 | 74 | 140µs | my $export_cache = ($Cache{$pkg} ||= {}); | ||
45 | 74 | 114µs | my $args = @_ or @_ = @$exports; | ||
46 | |||||
47 | 74 | 79µs | local $_; | ||
48 | 74 | 112µs | if ($args and not %$export_cache) { | ||
49 | s/^&//, $export_cache->{$_} = 1 | ||||
50 | 17 | 2.03ms | 450 | 487µs | foreach (@$exports, @{"$pkg\::EXPORT_OK"}); # spent 487µs making 450 calls to Exporter::CORE:subst, avg 1µs/call |
51 | } | ||||
52 | 74 | 63µs | my $heavy; | ||
53 | # Try very hard not to use {} and hence have to enter scope on the foreach | ||||
54 | # We bomb out of the loop with last as soon as heavy is set. | ||||
55 | 74 | 160µs | if ($args or $fail) { | ||
56 | ($heavy = (/\W/ or $args and not exists $export_cache->{$_} | ||||
57 | or $fail and @$fail and $_ eq $fail->[0])) and last | ||||
58 | 61 | 646µs | 81 | 141µs | foreach (@_); # spent 141µs making 81 calls to Exporter::CORE:match, avg 2µs/call |
59 | } else { | ||||
60 | ($heavy = /\W/) and last | ||||
61 | 13 | 106µs | 12 | 20µs | foreach (@_); # spent 20µs making 12 calls to Exporter::CORE:match, avg 2µs/call |
62 | } | ||||
63 | 74 | 221µs | 20 | 1.91ms | return export $pkg, $callpkg, ($args ? @_ : ()) if $heavy; # spent 1.91ms making 20 calls to Exporter::export, avg 95µs/call |
64 | local $SIG{__WARN__} = | ||||
65 | 54 | 276µs | sub {require Carp; &Carp::carp} if not $SIG{__WARN__}; | ||
66 | # shortcut for the common case of no type character | ||||
67 | 54 | 810µs | *{"$callpkg\::$_"} = \&{"$pkg\::$_"} foreach @_; | ||
68 | } | ||||
69 | |||||
70 | # Default methods | ||||
71 | |||||
72 | sub export_fail { | ||||
73 | my $self = shift; | ||||
74 | @_; | ||||
75 | } | ||||
76 | |||||
77 | # Unfortunately, caller(1)[3] "does not work" if the caller is aliased as | ||||
78 | # *name = \&foo. Thus the need to create a lot of identical subroutines | ||||
79 | # Otherwise we could have aliased them to export(). | ||||
80 | |||||
81 | # spent 57µs (16+41) within Exporter::export_to_level which was called 2 times, avg 28µs/call:
# 2 times (16µs+41µs) by Time::HiRes::import at line 62 of Time/HiRes.pm, avg 28µs/call | ||||
82 | 2 | 22µs | 4 | 453µs | goto &{as_heavy()}; # spent 412µs making 2 calls to Exporter::Heavy::heavy_export_to_level, avg 206µs/call
# spent 41µs making 2 calls to Exporter::as_heavy, avg 21µs/call |
83 | } | ||||
84 | |||||
85 | sub export_tags { | ||||
86 | goto &{as_heavy()}; | ||||
87 | } | ||||
88 | |||||
89 | # spent 44µs (11+34) within Exporter::export_ok_tags which was called:
# once (11µs+34µs) by DBI::BEGIN@163 at line 266 of DBI.pm | ||||
90 | 1 | 16µs | 2 | 83µs | goto &{as_heavy()}; # spent 50µs making 1 call to Exporter::Heavy::heavy_export_ok_tags
# spent 34µs making 1 call to Exporter::as_heavy |
91 | } | ||||
92 | |||||
93 | sub require_version { | ||||
94 | goto &{as_heavy()}; | ||||
95 | } | ||||
96 | |||||
97 | 1 | 4µs | 1; | ||
98 | __END__ | ||||
sub Exporter::CORE:match; # opcode | |||||
sub Exporter::CORE:subst; # opcode |