← Index
NYTProf Performance Profile   « line view »
For -e
  Run on Thu Mar 24 14:41:10 2016
Reported on Thu Mar 24 14:41:17 2016

Filename/home/s1/perl5/perlbrew/perls/perl-5.22.0/lib/5.22.0/Exporter.pm
StatementsExecuted 22 statements in 89µs
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
11152µs59µsExporter::::importExporter::import
1114µs4µsExporter::::CORE:matchExporter::CORE:match (opcode)
1113µs3µsExporter::::CORE:substExporter::CORE:subst (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
3123µsrequire 5.006;
4
5# Be lean.
6#use strict;
7#no strict 'refs';
8
91500nsour $Debug = 0;
101100nsour $ExportLevel = 0;
111800nsour $Verbose ||= 0;
121600nsour $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 59µs (52+7) within Exporter::import which was called: # once (52µs+7µs) by main::BEGIN@0 at line 0 of -e
sub import {
2911µs my $pkg = shift;
3012µs my $callpkg = caller($ExportLevel);
31
3211µ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 :-(
3816µ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.
4112µs my $fail = ${$pkg . '::'}{EXPORT_FAIL} && \@{"$pkg\::EXPORT_FAIL"};
421300ns return export $pkg, $callpkg, @_
43 if $Verbose or $Debug or $fail && @$fail > 1;
4412µs my $export_cache = ($Cache{$pkg} ||= {});
451400ns my $args = @_ or @_ = @$exports;
46
4712µs if ($args and not %$export_cache) {
48 s/^&//, $export_cache->{$_} = 1
49113µs13µs foreach (@$exports, @{"$pkg\::EXPORT_OK"});
# spent 3µs making 1 call to Exporter::CORE:subst
50 }
511100ns 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.
541400ns 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
57110µs14µs foreach (@_);
# spent 4µs making 1 call to Exporter::CORE:match
58 } else {
59 ($heavy = /\W/) and last
60 foreach (@_);
61 }
621200ns return export $pkg, $callpkg, ($args ? @_ : ()) if $heavy;
63 local $SIG{__WARN__} =
6415µs sub {require Carp; &Carp::carp} if not $SIG{__WARN__};
65 # shortcut for the common case of no type character
66114µ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 4µs within Exporter::CORE:match which was called: # once (4µs+0s) by Exporter::import at line 57
sub Exporter::CORE:match; # opcode
# spent 3µs within Exporter::CORE:subst which was called: # once (3µs+0s) by Exporter::import at line 49
sub Exporter::CORE:subst; # opcode