← Index
NYTProf Performance Profile   « line view »
For -e
  Run on Thu Jun 30 16:34:56 2016
Reported on Thu Jun 30 16:35:08 2016

Filename/home/s1/perl5/perlbrew/perls/perl-5.22.1/lib/5.22.1/Exporter.pm
StatementsExecuted 397 statements in 2.25ms
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
2929202.00ms2.15msExporter::::importExporter::import
8861198µs98µsExporter::::CORE:substExporter::CORE:subst (opcode)
1122154µs54µsExporter::::CORE:matchExporter::CORE:match (opcode)
0000s0sExporter::::__ANON__[:64]Exporter::__ANON__[:64]
0000s0sExporter::::as_heavyExporter::as_heavy
0000s0sExporter::::exportExporter::export
0000s0sExporter::::export_failExporter::export_fail
0000s0sExporter::::export_ok_tagsExporter::export_ok_tags
0000s0sExporter::::export_tagsExporter::export_tags
0000s0sExporter::::export_to_levelExporter::export_to_level
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
3110µsrequire 5.006;
4
5# Be lean.
6#use strict;
7#no strict 'refs';
8
91500nsour $Debug = 0;
101100nsour $ExportLevel = 0;
111300nsour $Verbose ||= 0;
121300nsour $VERSION = '5.72';
13our (%Cache);
14
15sub as_heavy {
16 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 my $c = (caller(1))[3];
20 $c =~ s/.*:://;
21 \&{"Exporter::Heavy::heavy_$c"};
22}
23
24sub export {
25 goto &{as_heavy()};
26}
27
28
# spent 2.15ms (2.00+152µs) within Exporter::import which was called 29 times, avg 74µs/call: # once (804µs+73µs) by POSIX::import at line 30 of POSIX.pm # once (299µs+25µs) by POSIX::BEGIN@11 at line 11 of POSIX.pm # once (66µs+7µs) by experimental::BEGIN@8 at line 8 of experimental.pm # once (60µs+4µs) by Params::Validate::BEGIN@12 at line 12 of Params/Validate.pm # once (53µs+4µs) by DateTime::Duration::BEGIN@11 at line 11 of DateTime/Duration.pm # once (51µs+4µs) by DateTime::Format::Alami::EN::BEGIN@14 at line 14 of lib/DateTime/Format/Alami/EN.pm # once (43µs+5µs) by DateTime::Locale::FromData::BEGIN@6 at line 6 of DateTime/Locale/FromData.pm # once (43µs+3µs) by Try::Tiny::BEGIN@13 at line 13 of Try/Tiny.pm # once (43µs+2µs) by Module::Implementation::BEGIN@9 at line 9 of Module/Implementation.pm # once (42µs+3µs) by DateTime::BEGIN@16 at line 17 of DateTime.pm # once (42µs+2µs) by Tie::Hash::BEGIN@190 at line 190 of Tie/Hash.pm # once (41µs+2µs) by DateTime::BEGIN@11 at line 11 of DateTime.pm # once (38µs+4µs) by DateTime::Format::Alami::EN::BEGIN@91 at line 91 of lib/DateTime/Format/Alami/EN.pm # once (38µs+2µs) by DateTime::TimeZone::BEGIN@15 at line 15 of DateTime/TimeZone.pm # once (39µs+0s) by Params::Validate::BEGIN@10 at line 10 of Params/Validate.pm # once (34µs+2µs) by DateTime::TimeZone::OlsonDB::Change::BEGIN@6 at line 6 of DateTime/TimeZone/OlsonDB/Change.pm # once (34µs+2µs) by Params::Validate::XS::BEGIN@8 at line 8 of Params/Validate/XS.pm # once (31µs+1µs) by DateTime::TimeZone::OffsetOnly::BEGIN@9 at line 9 of DateTime/TimeZone/OffsetOnly.pm # once (30µs+2µs) by DateTime::TimeZone::Local::BEGIN@9 at line 9 of DateTime/TimeZone/Local.pm # once (26µs+1µs) by DateTime::Locale::BEGIN@13 at line 13 of DateTime/Locale.pm # once (27µs+1µs) by DateTime::TimeZone::BEGIN@16 at line 16 of DateTime/TimeZone.pm # once (25µs+1µs) by DateTime::BEGIN@19 at line 19 of DateTime.pm # once (23µs+1µs) by DateTime::Locale::BEGIN@12 at line 12 of DateTime/Locale.pm # once (20µs+1µs) by DateTime::Locale::FromData::BEGIN@7 at line 7 of DateTime/Locale/FromData.pm # once (12µs+0s) by Parse::Number::EN::BEGIN@12 at line 12 of Parse/Number/EN.pm # once (11µs+0s) by Role::Tiny::With::BEGIN@11 at line 11 of Role/Tiny/With.pm # once (11µs+0s) by DateTime::Locale::Util::BEGIN@6 at line 6 of DateTime/Locale/Util.pm # once (10µs+0s) by Data::Graph::Util::BEGIN@10 at line 10 of Data/Graph/Util.pm # once (8µs+0s) by Try::Tiny::BEGIN@10 at line 10 of Try/Tiny.pm
sub import {
292913µs my $pkg = shift;
302921µs my $callpkg = caller($ExportLevel);
31
322918µs if ($pkg eq "Exporter" and @_ and $_[0] eq "import") {
33521µs *{$callpkg."::import"} = \&import;
34525µs return;
35 }
36
37 # We *need* to treat @{"$pkg\::EXPORT_FAIL"} since Carp uses it :-(
382445µ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.
412429µs my $fail = ${$pkg . '::'}{EXPORT_FAIL} && \@{"$pkg\::EXPORT_FAIL"};
422412µs return export $pkg, $callpkg, @_
43 if $Verbose or $Debug or $fail && @$fail > 1;
442427µs my $export_cache = ($Cache{$pkg} ||= {});
452424µs my $args = @_ or @_ = @$exports;
46
472410µs if ($args and not %$export_cache) {
48 s/^&//, $export_cache->{$_} = 1
4961.13ms88698µs foreach (@$exports, @{"$pkg\::EXPORT_OK"});
# spent 98µs making 886 calls to Exporter::CORE:subst, avg 111ns/call
50 }
51243µ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.
542410µ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
5717219µs8739µs foreach (@_);
# spent 39µs making 87 calls to Exporter::CORE:match, avg 453ns/call
58 } else {
59 ($heavy = /\W/) and last
60766µs2514µs foreach (@_);
# spent 14µs making 25 calls to Exporter::CORE:match, avg 564ns/call
61 }
62244µs return export $pkg, $callpkg, ($args ? @_ : ()) if $heavy;
63 local $SIG{__WARN__} =
6424133µs sub {require Carp; &Carp::carp} if not $SIG{__WARN__};
65 # shortcut for the common case of no type character
6624424µ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
80sub export_to_level {
81 goto &{as_heavy()};
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
9615µs1;
97__END__
 
# spent 54µs within Exporter::CORE:match which was called 112 times, avg 478ns/call: # 87 times (39µs+0s) by Exporter::import at line 57, avg 453ns/call # 25 times (14µs+0s) by Exporter::import at line 60, avg 564ns/call
sub Exporter::CORE:match; # opcode
# spent 98µs within Exporter::CORE:subst which was called 886 times, avg 111ns/call: # 886 times (98µs+0s) by Exporter::import at line 49, avg 111ns/call
sub Exporter::CORE:subst; # opcode