← Index
NYTProf Performance Profile   « block view • line view • sub view »
For bin/dpath
  Run on Tue Jun 5 15:31:33 2012
Reported on Tue Jun 5 15:31:47 2012

Filename/home/ss5/perl5/perlbrew/perls/perl-5.14.1/lib/5.14.1/Exporter.pm
StatementsExecuted 580 statements in 11.0ms
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
3737238.87ms30.2msExporter::::importExporter::import
3216.59ms6.91msExporter::::as_heavyExporter::as_heavy
23921558µs558µsExporter::::CORE:matchExporter::CORE:match (opcode)
23321345µs345µsExporter::::CORE:substExporter::CORE:subst (opcode)
21149µs6.90msExporter::::exportExporter::export
11124µs86µsExporter::::export_ok_tagsExporter::export_ok_tags
0000s0sExporter::::__ANON__[:64]Exporter::__ANON__[:64]
0000s0sExporter::::export_failExporter::export_fail
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
3157µsrequire 5.006;
4
5# Be lean.
6#use strict;
7#no strict 'refs';
8
912µsour $Debug = 0;
1011µsour $ExportLevel = 0;
1112µsour $Verbose ||= 0;
1212µsour $VERSION = '5.66';
1311µsour (%Cache);
14
15
# spent 6.91ms (6.59+325µs) within Exporter::as_heavy which was called 3 times, avg 2.30ms/call: # 2 times (6.55ms+304µs) by Exporter::export at line 25, avg 3.42ms/call # once (40µs+22µs) by Exporter::export_ok_tags at line 89
sub as_heavy {
163438µ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
19340µs my $c = (caller(1))[3];
20392µs356µs $c =~ s/.*:://;
# spent 56µs making 3 calls to Exporter::CORE:subst, avg 19µs/call
21363µs \&{"Exporter::Heavy::heavy_$c"};
22}
23
24
# spent 6.90ms (49µs+6.85) within Exporter::export which was called 2 times, avg 3.45ms/call: # 2 times (49µs+6.85ms) by Exporter::import at line 62, avg 3.45ms/call
sub export {
25254µs420.5ms goto &{as_heavy()};
# spent 13.6ms making 2 calls to Exporter::Heavy::heavy_export, avg 6.81ms/call # spent 6.85ms making 2 calls to Exporter::as_heavy, avg 3.42ms/call
26}
27
28
# spent 30.2ms (8.87+21.4) within Exporter::import which was called 37 times, avg 817µs/call: # once (872µs+19.9ms) by POSIX::import at line 29 of POSIX.pm # once (1.76ms+217µs) by POSIX::BEGIN@13 at line 13 of POSIX.pm # once (228µs+830µs) by Safe::BEGIN@46 at line 46 of Safe.pm # once (406µs+46µs) by Data::DPath::Context::BEGIN@16 at line 16 of Data/DPath/Context.pm # once (331µs+23µs) by Data::DPath::Context::BEGIN@19 at line 19 of Data/DPath/Context.pm # once (260µs+46µs) by Data::DPath::Path::BEGIN@17 at line 17 of Data/DPath/Path.pm # once (254µs+25µs) by Data::DPath::Context::BEGIN@17 at line 17 of Data/DPath/Context.pm # once (253µs+10µs) by Devel::StackTrace::BEGIN@13 at line 13 of Devel/StackTrace.pm # once (246µs+13µs) by IO::Handle::BEGIN@263 at line 263 of IO/Handle.pm # once (238µs+20µs) by Class::XSAccessor::Array::BEGIN@5 at line 5 of Class/XSAccessor/Array.pm # once (215µs+12µs) by Text::Balanced::BEGIN@343 at line 343 of Text/Balanced.pm # once (206µs+8µs) by SelectSaver::BEGIN@38 at line 38 of SelectSaver.pm # once (200µs+13µs) by IO::Handle::BEGIN@264 at line 264 of IO/Handle.pm # once (197µs+13µs) by Attribute::Handlers::BEGIN@3 at line 3 of Attribute/Handlers.pm # once (191µs+12µs) by Text::Balanced::BEGIN@885 at line 885 of Text/Balanced.pm # once (184µs+13µs) by Opcode::BEGIN@11 at line 11 of Opcode.pm # once (185µs+12µs) by Data::Dumper::BEGIN@20 at line 20 of Data/Dumper.pm # once (179µs+16µs) by Data::DPath::Context::BEGIN@20 at line 20 of Data/DPath/Context.pm # once (179µs+11µs) by Sub::Install::BEGIN@6 at line 6 of Sub/Install.pm # once (180µs+9µs) by Tie::Hash::BEGIN@188 at line 188 of Tie/Hash.pm # once (161µs+10µs) by Safe::BEGIN@4 at line 4 of Safe.pm # once (148µs+8µs) by IO::BEGIN@6 at line 6 of IO.pm # once (141µs+8µs) by Data::OptList::BEGIN@10 at line 95 of Params/Util.pm # once (142µs+7µs) by Safe::BEGIN@29 at line 29 of Safe.pm # once (140µs+8µs) by Exception::Class::BEGIN@11 at line 11 of Exception/Class.pm # once (138µs+7µs) by Class::XSAccessor::Heavy::BEGIN@7 at line 7 of Class/XSAccessor/Heavy.pm # once (137µs+8µs) by Data::DPath::Path::BEGIN@13 at line 13 of Data/DPath/Path.pm # once (133µs+10µs) by Text::Balanced::BEGIN@9 at line 9 of Text/Balanced.pm # once (133µs+9µs) by Exception::Class::Base::BEGIN@11 at line 11 of Exception/Class/Base.pm # once (129µs+6µs) by SelectSaver::BEGIN@39 at line 39 of SelectSaver.pm # once (126µs+7µs) by Data::DPath::Context::BEGIN@13 at line 13 of Data/DPath/Context.pm # once (119µs+9µs) by main::BEGIN@11 at line 11 of bin/dpath # once (107µs+5µs) by Data::DPath::Filters::BEGIN@13 at line 13 of Data/DPath/Filters.pm # once (100µs+5µs) by Class::XSAccessor::BEGIN@5 at line 5 of Class/XSAccessor.pm # once (101µs+0s) by SelfLoader::BEGIN@42 at line 42 of SelfLoader.pm # once (98µs+0s) by SelfLoader::BEGIN@4 at line 4 of SelfLoader.pm # once (60µs+0s) by Data::DPath::Filters::BEGIN@14 at line 14 of Data/DPath/Filters.pm
sub import {
2937100µs my $pkg = shift;
3037126µs my $callpkg = caller($ExportLevel);
31
323779µ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 :-(
3837333µ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.
4137359µs my $fail = ${$pkg . '::'}{EXPORT_FAIL} && \@{"$pkg\::EXPORT_FAIL"};
4237180µs return export $pkg, $callpkg, @_
43 if $Verbose or $Debug or $fail && @$fail > 1;
4437165µs my $export_cache = ($Cache{$pkg} ||= {});
4537371µs my $args = @_ or @_ = @$exports;
46
473761µs if ($args and not %$export_cache) {
48 s/^&//, $export_cache->{$_} = 1
4972.24ms230289µs foreach (@$exports, @{"$pkg\::EXPORT_OK"});
# spent 289µs making 230 calls to Exporter::CORE:subst, avg 1µs/call
50 }
513721µ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.
5437109µ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
57271.47ms95305µs foreach (@_);
# spent 305µs making 95 calls to Exporter::CORE:match, avg 3µs/call
58 } else {
59 ($heavy = /\W/) and last
60101.15ms144253µs foreach (@_);
# spent 253µs making 144 calls to Exporter::CORE:match, avg 2µs/call
61 }
6237206µs26.90ms return export $pkg, $callpkg, ($args ? @_ : ()) if $heavy;
# spent 6.90ms making 2 calls to Exporter::export, avg 3.45ms/call
63 local $SIG{__WARN__} =
6435825µs sub {require Carp; &Carp::carp} if not $SIG{__WARN__};
65 # shortcut for the common case of no type character
66352.42ms *{"$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
88
# spent 86µs (24+61) within Exporter::export_ok_tags which was called: # once (24µs+61µs) by Data::DPath::Path::BEGIN@17 at line 31 of Text/Balanced.pm
sub export_ok_tags {
89128µs2160µs goto &{as_heavy()};
# spent 99µs making 1 call to Exporter::Heavy::heavy_export_ok_tags # spent 61µs making 1 call to Exporter::as_heavy
90}
91
92sub require_version {
93 goto &{as_heavy()};
94}
95
96119µs1;
97__END__
 
# spent 558µs within Exporter::CORE:match which was called 239 times, avg 2µs/call: # 144 times (253µs+0s) by Exporter::import at line 60, avg 2µs/call # 95 times (305µs+0s) by Exporter::import at line 57, avg 3µs/call
sub Exporter::CORE:match; # opcode
# spent 345µs within Exporter::CORE:subst which was called 233 times, avg 1µs/call: # 230 times (289µs+0s) by Exporter::import at line 49, avg 1µs/call # 3 times (56µs+0s) by Exporter::as_heavy at line 20, avg 19µs/call
sub Exporter::CORE:subst; # opcode