← Index
NYTProf Performance Profile   « line view »
For t/optimization.t
  Run on Thu Jan 8 22:47:42 2015
Reported on Thu Jan 8 22:48:05 2015

Filename/home/ss5/perl5/perlbrew/perls/tapper-perl/lib/5.16.3/Exporter.pm
StatementsExecuted 770 statements in 3.21ms
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
4949312.64ms6.08msExporter::::importExporter::import
5311.54ms1.64msExporter::::as_heavyExporter::as_heavy
29121120µs120µsExporter::::CORE:matchExporter::CORE:match (opcode)
2492165µs65µsExporter::::CORE:substExporter::CORE:subst (opcode)
32218µs58µsExporter::::exportExporter::export
11110µs1.60msExporter::::export_to_levelExporter::export_to_level
1118µs25µsExporter::::export_ok_tagsExporter::export_ok_tags
0000s0sExporter::::__ANON__[:64]Exporter::__ANON__[:64]
0000s0sExporter::::export_failExporter::export_fail
0000s0sExporter::::export_tagsExporter::export_tags
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
3111µsrequire 5.006;
4
5# Be lean.
6#use strict;
7#no strict 'refs';
8
91500nsour $Debug = 0;
101100nsour $ExportLevel = 0;
111300nsour $Verbose ||= 0;
121400nsour $VERSION = '5.66';
131400nsour (%Cache);
14
15
# spent 1.64ms (1.54+96µs) within Exporter::as_heavy which was called 5 times, avg 328µs/call: # 3 times (32µs+8µs) by Exporter::export at line 25, avg 13µs/call # once (1.50ms+84µs) by Exporter::export_to_level at line 81 # once (12µs+4µs) by Exporter::export_ok_tags at line 89
sub as_heavy {
16579µ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
19519µs my $c = (caller(1))[3];
20543µs521µs $c =~ s/.*:://;
# spent 21µs making 5 calls to Exporter::CORE:subst, avg 4µs/call
21528µs \&{"Exporter::Heavy::heavy_$c"};
22}
23
24
# spent 58µs (18+40) within Exporter::export which was called 3 times, avg 19µs/call: # 2 times (13µs+30µs) by Exporter::import at line 62, avg 21µs/call # once (6µs+10µs) by Exporter::Heavy::heavy_export_to_level at line 214 of Exporter/Heavy.pm
sub export {
25324µs63.47ms goto &{as_heavy()};
# spent 3.43ms making 3 calls to Exporter::Heavy::heavy_export, avg 1.14ms/call # spent 40µs making 3 calls to Exporter::as_heavy, avg 13µs/call
26}
27
28
# spent 6.08ms (2.64+3.44) within Exporter::import which was called 49 times, avg 124µs/call: # once (225µs+3.10ms) by POSIX::import at line 30 of POSIX.pm # once (430µs+31µs) by POSIX::BEGIN@11 at line 11 of POSIX.pm # once (62µs+210µs) by Safe::BEGIN@46 at line 46 of Safe.pm # once (199µs+11µs) by main::BEGIN@7 at line 7 of t/optimization.t # once (94µs+5µs) by Data::DPath::Context::BEGIN@10 at line 10 of lib/Data/DPath/Context.pm # once (75µs+4µs) by Data::DPath::Context::BEGIN@13 at line 13 of lib/Data/DPath/Context.pm # once (70µs+5µs) by Data::DPath::Context::BEGIN@14 at line 34 of List/Util.pm # once (65µs+9µs) by Data::DPath::Path::BEGIN@11 at line 11 of lib/Data/DPath/Path.pm # once (67µs+6µs) by Test::Deep::BEGIN@5 at line 5 of Test/Deep.pm # once (68µs+4µs) by Test::Deep::Cache::Simple::BEGIN@7 at line 7 of Test/Deep/Cache/Simple.pm # once (69µs+3µs) by IO::Handle::BEGIN@264 at line 264 of IO/Handle.pm # once (50µs+3µs) by Opcode::BEGIN@11 at line 11 of Opcode.pm # once (46µs+2µs) by IO::Handle::BEGIN@263 at line 263 of IO/Handle.pm # once (44µs+1µs) by Test::Deep::Shallow::BEGIN@8 at line 8 of Test/Deep/Shallow.pm # once (42µs+2µs) by Tie::Hash::BEGIN@188 at line 188 of Tie/Hash.pm # once (42µs+2µs) by Sub::Install::BEGIN@6 at line 6 of Sub/Install.pm # once (42µs+2µs) by Data::Dumper::BEGIN@22 at line 22 of Data/Dumper.pm # once (42µs+2µs) by Text::Balanced::BEGIN@343 at line 343 of Text/Balanced.pm # once (40µs+2µs) by Data::DPath::Path::BEGIN@7 at line 7 of lib/Data/DPath/Path.pm # once (39µs+2µs) by Text::Balanced::BEGIN@885 at line 885 of Text/Balanced.pm # once (39µs+0s) by Test::Deep::BEGIN@12 at line 12 of Test/Deep.pm # once (37µs+2µs) by Class::XSAccessor::Heavy::BEGIN@7 at line 7 of Class/XSAccessor/Heavy.pm # once (37µs+2µs) by SelectSaver::BEGIN@38 at line 38 of SelectSaver.pm # once (36µs+2µs) by Safe::BEGIN@29 at line 29 of Safe.pm # once (34µs+2µs) by IO::BEGIN@6 at line 6 of IO.pm # once (34µs+2µs) by Safe::BEGIN@4 at line 4 of Safe.pm # once (34µs+2µs) by SelectSaver::BEGIN@39 at line 39 of SelectSaver.pm # once (33µs+1µs) by Test::Deep::Blessed::BEGIN@8 at line 8 of Test/Deep/Blessed.pm # once (32µs+1µs) by Devel::StackTrace::BEGIN@13 at line 13 of Devel/StackTrace.pm # once (31µs+1µs) by Class::XSAccessor::Array::BEGIN@5 at line 5 of Class/XSAccessor/Array.pm # once (30µs+1µs) by Data::OptList::BEGIN@10 at line 95 of Params/Util.pm # once (30µs+1µs) by Exception::Class::BEGIN@11 at line 11 of Exception/Class.pm # once (29µs+1µs) by Test::Deep::Cache::Simple::BEGIN@5 at line 5 of Test/Deep/Cache/Simple.pm # once (29µs+1µs) by Test::Deep::Ref::BEGIN@8 at line 8 of Test/Deep/Ref.pm # once (29µs+1µs) by Text::Balanced::BEGIN@9 at line 9 of Text/Balanced.pm # once (29µs+1µs) by Exception::Class::Base::BEGIN@11 at line 11 of Exception/Class/Base.pm # once (28µs+1µs) by Test::Deep::Stack::BEGIN@6 at line 6 of Test/Deep/Stack.pm # once (28µs+1µs) by Test::Deep::RefType::BEGIN@8 at line 8 of Test/Deep/RefType.pm # once (27µs+1µs) by Class::XSAccessor::BEGIN@5 at line 5 of Class/XSAccessor.pm # once (27µs+1µs) by Data::DPath::Context::BEGIN@7 at line 7 of lib/Data/DPath/Context.pm # once (26µs+900ns) by Data::DPath::Context::BEGIN@11 at line 11 of lib/Data/DPath/Context.pm # once (26µs+1µs) by Test::Deep::Cache::Simple::BEGIN@10 at line 19 of Test/Deep/Cache/Simple.pm # once (26µs+1µs) by Data::DPath::Filters::BEGIN@7 at line 7 of lib/Data/DPath/Filters.pm # once (25µs+1µs) by main::BEGIN@9 at line 9 of t/optimization.t # once (22µs+0s) by Test::Deep::Cmp::BEGIN@12 at line 12 of Test/Deep/Cmp.pm # once (21µs+0s) by SelfLoader::BEGIN@4 at line 4 of SelfLoader.pm # once (19µs+0s) by SelfLoader::BEGIN@42 at line 42 of SelfLoader.pm # once (16µs+0s) by Data::DPath::Filters::BEGIN@8 at line 8 of lib/Data/DPath/Filters.pm # once (15µs+0s) by Test::Deep::Stack::BEGIN@7 at line 7 of Test/Deep/Stack.pm
sub import {
294927µs my $pkg = shift;
304946µs my $callpkg = caller($ExportLevel);
31
324921µ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 :-(
3849114µ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.
414997µs my $fail = ${$pkg . '::'}{EXPORT_FAIL} && \@{"$pkg\::EXPORT_FAIL"};
424933µs return export $pkg, $callpkg, @_
43 if $Verbose or $Debug or $fail && @$fail > 1;
444946µs my $export_cache = ($Cache{$pkg} ||= {});
4549103µs my $args = @_ or @_ = @$exports;
46
474922µs if ($args and not %$export_cache) {
48 s/^&//, $export_cache->{$_} = 1
497540µs24445µs foreach (@$exports, @{"$pkg\::EXPORT_OK"});
# spent 45µs making 244 calls to Exporter::CORE:subst, avg 183ns/call
50 }
51499µ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.
544932µ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
5737408µs10067µs foreach (@_);
# spent 67µs making 100 calls to Exporter::CORE:match, avg 673ns/call
58 } else {
59 ($heavy = /\W/) and last
6012360µs19153µs foreach (@_);
# spent 53µs making 191 calls to Exporter::CORE:match, avg 279ns/call
61 }
624950µs242µs return export $pkg, $callpkg, ($args ? @_ : ()) if $heavy;
# spent 42µs making 2 calls to Exporter::export, avg 21µs/call
63 local $SIG{__WARN__} =
6447244µs sub {require Carp; &Carp::carp} if not $SIG{__WARN__};
65 # shortcut for the common case of no type character
6647827µ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
80
# spent 1.60ms (10µs+1.58) within Exporter::export_to_level which was called: # once (10µs+1.58ms) by Test::Builder::Module::import at line 93 of Test/Builder/Module.pm
sub export_to_level {
81114µs21.82ms goto &{as_heavy()};
# spent 1.58ms making 1 call to Exporter::as_heavy # spent 231µs making 1 call to Exporter::Heavy::heavy_export_to_level
82}
83
84sub export_tags {
85 goto &{as_heavy()};
86}
87
88
# spent 25µs (8+16) within Exporter::export_ok_tags which was called: # once (8µs+16µs) by Data::DPath::Path::BEGIN@11 at line 31 of Text/Balanced.pm
sub export_ok_tags {
8919µs240µs goto &{as_heavy()};
# spent 24µs making 1 call to Exporter::Heavy::heavy_export_ok_tags # spent 16µs making 1 call to Exporter::as_heavy
90}
91
92sub require_version {
93 goto &{as_heavy()};
94}
95
9615µs1;
97__END__
 
# spent 120µs within Exporter::CORE:match which was called 291 times, avg 414ns/call: # 191 times (53µs+0s) by Exporter::import at line 60, avg 279ns/call # 100 times (67µs+0s) by Exporter::import at line 57, avg 673ns/call
sub Exporter::CORE:match; # opcode
# spent 65µs within Exporter::CORE:subst which was called 249 times, avg 262ns/call: # 244 times (45µs+0s) by Exporter::import at line 49, avg 183ns/call # 5 times (21µs+0s) by Exporter::as_heavy at line 20, avg 4µs/call
sub Exporter::CORE:subst; # opcode