← Index
NYTProf Performance Profile   « block view • line view • sub view »
For -e
  Run on Sun Aug 5 15:24:32 2012
Reported on Sun Aug 5 15:24:57 2012

Filename/usr/lib/perl5/5.12.4/Exporter.pm
StatementsExecuted 289 statements in 13.0ms
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
16161110.4ms40.3msExporter::::importExporter::import
1117.40ms7.84msExporter::::as_heavyExporter::as_heavy
20811885µs885µsExporter::::CORE:matchExporter::CORE:match (opcode)
18521662µs662µsExporter::::CORE:substExporter::CORE:subst (opcode)
11141µs7.88msExporter::::exportExporter::export
0000s0sExporter::::__ANON__[:62]Exporter::__ANON__[:62]
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
31107µsrequire 5.006;
4
5# Be lean.
6#use strict;
7#no strict 'refs';
8
914µsour $Debug = 0;
1012µsour $ExportLevel = 0;
1113µsour $Verbose ||= 0;
1214µsour $VERSION = '5.64_01';
1313µsour (%Cache);
14
15
# spent 7.84ms (7.40+449µs) within Exporter::as_heavy which was called: # once (7.40ms+449µs) by Exporter::export at line 25
sub as_heavy {
161534µ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
19118µs my $c = (caller(1))[3];
20151µs122µs $c =~ s/.*:://;
# spent 22µs making 1 call to Exporter::CORE:subst
21135µs \&{"Exporter::Heavy::heavy_$c"};
22}
23
24
# spent 7.88ms (41µs+7.84) within Exporter::export which was called: # once (41µs+7.84ms) by Exporter::import at line 60
sub export {
25147µs228.4ms goto &{as_heavy()};
# spent 20.5ms making 1 call to Exporter::Heavy::heavy_export # spent 7.84ms making 1 call to Exporter::as_heavy
26}
27
28
# spent 40.3ms (10.4+29.9) within Exporter::import which was called 16 times, avg 2.52ms/call: # once (2.23ms+28.9ms) by POSIX::import at line 29 of POSIX.pm # once (3.49ms+702µs) by POSIX::BEGIN@13 at line 13 of POSIX.pm # once (574µs+50µs) by Params::Validate::BEGIN@13 at line 13 of Params/Validate.pm # once (542µs+53µs) by DateTime::BEGIN@47 at line 47 of DateTime.pm # once (516µs+67µs) by DateTime::Duration::BEGIN@12 at line 12 of DateTime/Duration.pm # once (375µs+33µs) by DateTime::BEGIN@48 at line 49 of DateTime.pm # once (354µs+25µs) by DateTime::TimeZone::BEGIN@15 at line 15 of DateTime/TimeZone.pm # once (313µs+34µs) by DateTime::Locale::Base::BEGIN@6 at line 6 of DateTime/Locale/Base.pm # once (321µs+18µs) by DateTime::BEGIN@42 at line 42 of DateTime.pm # once (279µs+14µs) by Try::Tiny::BEGIN@46 at line 46 of Try/Tiny.pm # once (274µs+19µs) by DateTime::Locale::BEGIN@12 at line 12 of DateTime/Locale.pm # once (270µs+16µs) by Module::Implementation::BEGIN@10 at line 10 of Module/Implementation.pm # once (262µs+16µs) by Tie::Hash::BEGIN@188 at line 188 of Tie/Hash.pm # once (228µs+12µs) by DateTime::TimeZone::OffsetOnly::BEGIN@12 at line 12 of DateTime/TimeZone/OffsetOnly.pm # once (192µs+9µs) by DateTime::Locale::Base::BEGIN@9 at line 9 of DateTime/Locale/Base.pm # once (151µs+0s) by Params::Validate::BEGIN@11 at line 11 of Params/Validate.pm
sub import {
291697µs my $pkg = shift;
301698µs my $callpkg = caller($ExportLevel);
31
321666µ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 :-(
3816337µs my($exports, $fail) = (\@{"$pkg\::EXPORT"}, \@{"$pkg\::EXPORT_FAIL"});
391691µs return export $pkg, $callpkg, @_
40 if $Verbose or $Debug or @$fail > 1;
4116116µs my $export_cache = ($Cache{$pkg} ||= {});
4216699µs my $args = @_ or @_ = @$exports;
43
441653µs local $_;
451667µs if ($args and not %$export_cache) {
46 s/^&//, $export_cache->{$_} = 1
4783.50ms184640µs foreach (@$exports, @{"$pkg\::EXPORT_OK"});
# spent 640µs making 184 calls to Exporter::CORE:subst, avg 3µs/call
48 }
491636µs my $heavy;
50 # Try very hard not to use {} and hence have to enter scope on the foreach
51 # We bomb out of the loop with last as soon as heavy is set.
5216105µs if ($args or $fail) {
53 ($heavy = (/\W/ or $args and not exists $export_cache->{$_}
54 or @$fail and $_ eq $fail->[0])) and last
55324.04ms208885µs foreach (@_);
# spent 885µs making 208 calls to Exporter::CORE:match, avg 4µs/call
56 } else {
57 ($heavy = /\W/) and last
58 foreach (@_);
59 }
6016235µs17.88ms return export $pkg, $callpkg, ($args ? @_ : ()) if $heavy;
# spent 7.88ms making 1 call to Exporter::export
61 local $SIG{__WARN__} =
6215460µs sub {require Carp; &Carp::carp};
63 # shortcut for the common case of no type character
64302.19ms *{"$callpkg\::$_"} = \&{"$pkg\::$_"} foreach @_;
65}
66
67# Default methods
68
69sub export_fail {
70 my $self = shift;
71 @_;
72}
73
74# Unfortunately, caller(1)[3] "does not work" if the caller is aliased as
75# *name = \&foo. Thus the need to create a lot of identical subroutines
76# Otherwise we could have aliased them to export().
77
78sub export_to_level {
79 goto &{as_heavy()};
80}
81
82sub export_tags {
83 goto &{as_heavy()};
84}
85
86sub export_ok_tags {
87 goto &{as_heavy()};
88}
89
90sub require_version {
91 goto &{as_heavy()};
92}
93
94122µs1;
95__END__
 
# spent 885µs within Exporter::CORE:match which was called 208 times, avg 4µs/call: # 208 times (885µs+0s) by Exporter::import at line 55, avg 4µs/call
sub Exporter::CORE:match; # opcode
# spent 662µs within Exporter::CORE:subst which was called 185 times, avg 4µs/call: # 184 times (640µs+0s) by Exporter::import at line 47, avg 3µs/call # once (22µs+0s) by Exporter::as_heavy at line 20
sub Exporter::CORE:subst; # opcode