← Index
NYTProf Performance Profile   « block view • line view • sub view »
For t/app_dpath.t
  Run on Tue Jun 5 15:25:28 2012
Reported on Tue Jun 5 15:26:08 2012

Filename/home/ss5/perl5/perlbrew/perls/perl-5.14.1/lib/5.14.1/Exporter.pm
StatementsExecuted 670 statements in 11.8ms
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
4141239.47ms13.1msExporter::::importExporter::import
9216.81ms7.21msExporter::::as_heavyExporter::as_heavy
19221477µs477µsExporter::::CORE:matchExporter::CORE:match (opcode)
26721426µs426µsExporter::::CORE:substExporter::CORE:subst (opcode)
743119µs472µsExporter::::exportExporter::export
22254µs6.91msExporter::::export_to_levelExporter::export_to_level
0000s0sExporter::::__ANON__[:64]Exporter::__ANON__[:64]
0000s0sExporter::::export_failExporter::export_fail
0000s0sExporter::::export_ok_tagsExporter::export_ok_tags
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
3165µsrequire 5.006;
4
5# Be lean.
6#use strict;
7#no strict 'refs';
8
912µsour $Debug = 0;
101800nsour $ExportLevel = 0;
1112µsour $Verbose ||= 0;
1212µsour $VERSION = '5.66';
1312µsour (%Cache);
14
15
# spent 7.21ms (6.81+399µs) within Exporter::as_heavy which was called 9 times, avg 801µs/call: # 7 times (274µs+79µs) by Exporter::export at line 25, avg 50µs/call # 2 times (6.53ms+320µs) by Exporter::export_to_level at line 81, avg 3.43ms/call
sub as_heavy {
169411µ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
19996µs my $c = (caller(1))[3];
209276µs9128µs $c =~ s/.*:://;
# spent 128µs making 9 calls to Exporter::CORE:subst, avg 14µs/call
219145µs \&{"Exporter::Heavy::heavy_$c"};
22}
23
24
# spent 472µs (119+353) within Exporter::export which was called 7 times, avg 67µs/call: # 3 times (57µs+203µs) by Exporter::import at line 62, avg 86µs/call # 2 times (32µs+63µs) by Exporter::Heavy::heavy_export_to_level at line 214 of Exporter/Heavy.pm, avg 48µs/call # once (17µs+55µs) by FileHandle::import at line 73 of FileHandle.pm # once (13µs+32µs) by FileHandle::import at line 81 of FileHandle.pm
sub export {
257172µs146.28ms goto &{as_heavy()};
# spent 5.93ms making 7 calls to Exporter::Heavy::heavy_export, avg 847µs/call # spent 353µs making 7 calls to Exporter::as_heavy, avg 50µs/call
26}
27
28
# spent 13.1ms (9.47+3.65) within Exporter::import which was called 41 times, avg 320µs/call: # once (121µs+1.73ms) by English::import at line 74 of English.pm # once (1.13ms+164µs) by IO::Seekable::BEGIN@104 at line 104 of IO/Seekable.pm # once (245µs+807µs) by File::Glob::import at line 45 of File/Glob.pm # once (789µs+75µs) by main::BEGIN@8 at line 8 of t/app_dpath.t # once (749µs+53µs) by Config::General::BEGIN@19 at line 148 of IO/File.pm # once (620µs+68µs) by Config::General::BEGIN@20 at line 39 of FileHandle.pm # once (516µs+53µs) by Config::General::BEGIN@19 at line 19 of Config/General.pm # once (90µs+388µs) by Storable::BEGIN@51 at line 52 of Storable.pm # once (313µs+30µs) by Config::General::BEGIN@21 at line 21 of Config/General.pm # once (266µs+29µs) by Data::Structure::Util::BEGIN@8 at line 8 of Data/Structure/Util.pm # once (249µs+22µs) by main::BEGIN@13 at line 13 of t/app_dpath.t # once (242µs+24µs) by Test::Deep::Cache::Simple::BEGIN@7 at line 7 of Test/Deep/Cache/Simple.pm # once (210µs+15µs) by Data::Dumper::BEGIN@20 at line 20 of Data/Dumper.pm # once (194µs+19µs) by Test::Deep::BEGIN@5 at line 5 of Test/Deep.pm # once (197µs+13µs) by main::BEGIN@10 at line 10 of t/app_dpath.t # once (188µs+10µs) by IO::Seekable::BEGIN@98 at line 98 of IO/Seekable.pm # once (184µs+13µs) by IO::File::BEGIN@131 at line 131 of IO/File.pm # once (184µs+13µs) by Data::Structure::Util::BEGIN@9 at line 9 of Data/Structure/Util.pm # once (173µs+15µs) by Test::Deep::Ref::BEGIN@8 at line 8 of Test/Deep/Ref.pm # once (174µs+11µs) by IO::File::BEGIN@130 at line 130 of IO/File.pm # once (159µs+10µs) by IO::Handle::BEGIN@263 at line 263 of IO/Handle.pm # once (159µs+9µs) by Config::General::BEGIN@32 at line 32 of Config/General.pm # once (159µs+8µs) by SelectSaver::BEGIN@38 at line 38 of SelectSaver.pm # once (162µs+0s) by Test::Deep::Cmp::BEGIN@12 at line 12 of Test/Deep/Cmp.pm # once (148µs+7µs) by IO::Handle::BEGIN@264 at line 264 of IO/Handle.pm # once (148µs+5µs) by Test::Deep::RefType::BEGIN@8 at line 8 of Test/Deep/RefType.pm # once (145µs+5µs) by Test::Deep::Shallow::BEGIN@8 at line 8 of Test/Deep/Shallow.pm # once (137µs+10µs) by IO::File::BEGIN@133 at line 133 of IO/File.pm # once (136µs+9µs) by main::BEGIN@6 at line 6 of t/app_dpath.t # once (137µs+6µs) by Test::Deep::Blessed::BEGIN@8 at line 8 of Test/Deep/Blessed.pm # once (131µs+7µs) by Test::Deep::Stack::BEGIN@6 at line 6 of Test/Deep/Stack.pm # once (128µs+8µs) by IO::BEGIN@6 at line 6 of IO.pm # once (123µs+8µs) by SelectSaver::BEGIN@39 at line 39 of SelectSaver.pm # once (123µs+6µs) by Test::Deep::Cache::Simple::BEGIN@10 at line 19 of Test/Deep/Cache/Simple.pm # once (118µs+0s) by main::BEGIN@11 at line 11 of t/app_dpath.t # once (109µs+5µs) by Test::Deep::Cache::Simple::BEGIN@5 at line 5 of Test/Deep/Cache/Simple.pm # once (103µs+0s) by JSON::XS::BEGIN@121 at line 121 of JSON/XS.pm # once (100µs+0s) by Test::Deep::BEGIN@12 at line 12 of Test/Deep.pm # once (85µs+0s) by YAML::Syck::BEGIN@13 at line 13 of YAML/Syck.pm # once (68µs+0s) by Test::Deep::Stack::BEGIN@7 at line 7 of Test/Deep/Stack.pm # once (55µs+0s) by Config::General::BEGIN@33 at line 33 of Config/General.pm
sub import {
2941107µs my $pkg = shift;
3041122µs my $callpkg = caller($ExportLevel);
31
324184µ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 :-(
3841322µ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.
4141268µs my $fail = ${$pkg . '::'}{EXPORT_FAIL} && \@{"$pkg\::EXPORT_FAIL"};
4241127µs return export $pkg, $callpkg, @_
43 if $Verbose or $Debug or $fail && @$fail > 1;
4441184µs my $export_cache = ($Cache{$pkg} ||= {});
4541255µs my $args = @_ or @_ = @$exports;
46
474173µs if ($args and not %$export_cache) {
48 s/^&//, $export_cache->{$_} = 1
4992.22ms258298µs foreach (@$exports, @{"$pkg\::EXPORT_OK"});
# spent 298µs making 258 calls to Exporter::CORE:subst, avg 1µs/call
50 }
514127µ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.
5441123µ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
57281.41ms92283µs foreach (@_);
# spent 283µs making 92 calls to Exporter::CORE:match, avg 3µs/call
58 } else {
59 ($heavy = /\W/) and last
6013891µs100195µs foreach (@_);
# spent 195µs making 100 calls to Exporter::CORE:match, avg 2µs/call
61 }
6241126µs3259µs return export $pkg, $callpkg, ($args ? @_ : ()) if $heavy;
# spent 259µs making 3 calls to Exporter::export, avg 86µs/call
63 local $SIG{__WARN__} =
64381.05ms sub {require Carp; &Carp::carp} if not $SIG{__WARN__};
65 # shortcut for the common case of no type character
66383.18ms *{"$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 6.91ms (54µs+6.85) within Exporter::export_to_level which was called 2 times, avg 3.45ms/call: # once (35µs+6.79ms) by Test::Builder::Module::import at line 93 of Test/Builder/Module.pm # once (19µs+62µs) by JSON::import at line 111 of JSON.pm
sub export_to_level {
81282µs48.13ms goto &{as_heavy()};
# spent 6.85ms making 2 calls to Exporter::as_heavy, avg 3.43ms/call # spent 1.27ms making 2 calls to Exporter::Heavy::heavy_export_to_level, avg 636µs/call
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
96120µs1;
97__END__
 
# spent 477µs within Exporter::CORE:match which was called 192 times, avg 2µs/call: # 100 times (195µs+0s) by Exporter::import at line 60, avg 2µs/call # 92 times (283µs+0s) by Exporter::import at line 57, avg 3µs/call
sub Exporter::CORE:match; # opcode
# spent 426µs within Exporter::CORE:subst which was called 267 times, avg 2µs/call: # 258 times (298µs+0s) by Exporter::import at line 49, avg 1µs/call # 9 times (128µs+0s) by Exporter::as_heavy at line 20, avg 14µs/call
sub Exporter::CORE:subst; # opcode