← Index
NYTProf Performance Profile   « block view • line view • sub view »
For conv.pl
  Run on Sun Nov 14 21:14:18 2010
Reported on Sun Nov 14 21:17:54 2010

Filename/usr/share/perl/5.10/Exporter.pm
StatementsExecuted 936 statements in 7.55ms
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
5252296.20ms16.9msExporter::::importExporter::import
7112.24ms2.37msExporter::::as_heavyExporter::as_heavy
34311447µs447µsExporter::::CORE:matchExporter::CORE:match (opcode)
27621328µs328µsExporter::::CORE:substExporter::CORE:subst (opcode)
73263µs2.43msExporter::::exportExporter::export
0000s0sExporter::::__ANON__[:65]Exporter::__ANON__[:65]
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
3121µsrequire 5.006;
4
5# Be lean.
6#use strict;
7#no strict 'refs';
8
911µsour $Debug = 0;
1011µsour $ExportLevel = 0;
1111µsour $Verbose ||= 0;
1211µsour $VERSION = '5.63';
1311µsour (%Cache);
14
15# Carp 1.05+ does this now for us, but we may be running with an old Carp
1612µs$Carp::Internal{Exporter}++;
17
18
# spent 2.37ms (2.24+132µs) within Exporter::as_heavy which was called 7 times, avg 339µs/call: # 7 times (2.24ms+132µs) by Exporter::export at line 28, avg 339µs/call
sub as_heavy {
197149µs require Exporter::Heavy;
20 # Unfortunately, this does not work if the caller is aliased as *name = \&foo
21 # Thus the need to create a lot of identical subroutines
22736µs my $c = (caller(1))[3];
23770µs725µs $c =~ s/.*:://;
# spent 25µs making 7 calls to Exporter::CORE:subst, avg 4µs/call
24748µs \&{"Exporter::Heavy::heavy_$c"};
25}
26
27
# spent 2.43ms (63µs+2.37) within Exporter::export which was called 7 times, avg 348µs/call: # 5 times (45µs+2.33ms) by Exporter::import at line 63, avg 476µs/call # once (9µs+20µs) by FileHandle::import at line 73 of FileHandle.pm # once (9µs+17µs) by FileHandle::import at line 81 of FileHandle.pm
sub export {
28776µs1410.9ms goto &{as_heavy()};
# spent 8.56ms making 7 calls to Exporter::Heavy::heavy_export, avg 1.22ms/call # spent 2.37ms making 7 calls to Exporter::as_heavy, avg 339µs/call
29}
30
31
# spent 16.9ms (6.20+10.7) within Exporter::import which was called 52 times, avg 326µs/call: # once (674µs+8.62ms) by POSIX::import at line 29 of POSIX.pm # once (942µs+216µs) by POSIX::BEGIN@13 at line 13 of POSIX.pm # once (139µs+476µs) by MARC::Charset::Code::BEGIN@8 at line 8 of MARC/Charset/Code.pm # once (70µs+451µs) by MARC::Charset::Table::BEGIN@39 at line 39 of MARC/Charset/Table.pm # once (39µs+430µs) by MARC::Charset::BEGIN@14 at line 14 of MARC/Charset.pm # once (319µs+48µs) by MARC::File::XML::BEGIN@13 at line 13 of MARC/File/XML.pm # once (308µs+51µs) by Storable::BEGIN@23 at line 39 of FileHandle.pm # once (303µs+33µs) by Storable::BEGIN@23 at line 26 of IO/File.pm # once (260µs+41µs) by MARC::Charset::BEGIN@11 at line 11 of MARC/Charset.pm # once (38µs+175µs) by Storable::BEGIN@44 at line 45 of Storable.pm # once (150µs+18µs) by MARC::Charset::Table::BEGIN@40 at line 40 of MARC/Charset/Table.pm # once (152µs+10µs) by MARC::File::Encode::BEGIN@22 at line 22 of MARC/File/Encode.pm # once (128µs+4µs) by XML::SAX::Exception::BEGIN@10 at line 10 of XML/SAX/Exception.pm # once (96µs+7µs) by MARC::Charset::BEGIN@10 at line 10 of MARC/Charset.pm # once (93µs+10µs) by MARC::Record::BEGIN@15 at line 15 of MARC/Record.pm # once (87µs+9µs) by XML::SAX::BEGIN@17 at line 17 of XML/SAX.pm # once (91µs+5µs) by Data::Dumper::BEGIN@20 at line 20 of Data/Dumper.pm # once (85µs+4µs) by MARC::File::SAX::BEGIN@12 at line 12 of MARC/File/SAX.pm # once (83µs+6µs) by IO::File::BEGIN@9 at line 9 of IO/File.pm # once (84µs+4µs) by Unicode::Normalize::BEGIN@12 at line 12 of Unicode/Normalize.pm # once (83µs+5µs) by Carp::BEGIN@5 at line 5 of Carp/Heavy.pm # once (83µs+4µs) by MARC::Field::BEGIN@5 at line 5 of MARC/Field.pm # once (82µs+5µs) by XML::Parser::ExpatNB::BEGIN@588 at line 588 of XML/Parser/Expat.pm # once (83µs+4µs) by IO::File::BEGIN@8 at line 8 of IO/File.pm # once (78µs+7µs) by XML::SAX::BEGIN@15 at line 15 of XML/SAX.pm # once (79µs+6µs) by XML::Parser::BEGIN@11 at line 11 of XML/Parser.pm # once (74µs+7µs) by MARC::File::XML::BEGIN@10 at line 10 of MARC/File/XML.pm # once (74µs+5µs) by MARC::File::SAX::BEGIN@14 at line 14 of MARC/File/SAX.pm # once (72µs+4µs) by MARC::File::USMARC::BEGIN@13 at line 13 of MARC/File/USMARC.pm # once (72µs+4µs) by IO::File::BEGIN@11 at line 11 of IO/File.pm # once (70µs+5µs) by IO::Handle::BEGIN@6 at line 6 of IO/Handle.pm # once (70µs+5µs) by Tie::Hash::BEGIN@5 at line 5 of Tie/Hash.pm # once (70µs+5µs) by SelectSaver::BEGIN@6 at line 6 of SelectSaver.pm # once (70µs+5µs) by SelectSaver::BEGIN@7 at line 7 of SelectSaver.pm # once (69µs+5µs) by IO::BEGIN@6 at line 6 of IO.pm # once (68µs+5µs) by IO::Handle::BEGIN@7 at line 7 of IO/Handle.pm # once (68µs+4µs) by XML::Parser::Expat::BEGIN@8 at line 8 of XML/Parser/Expat.pm # once (68µs+4µs) by IO::Seekable::BEGIN@6 at line 6 of IO/Seekable.pm # once (67µs+4µs) by IO::Seekable::BEGIN@12 at line 12 of IO/Seekable.pm # once (67µs+3µs) by Encode::BEGIN@48 at line 48 of Encode.pm # once (63µs+3µs) by MARC::File::USMARC::BEGIN@18 at line 18 of MARC/File/USMARC.pm # once (60µs+3µs) by MARC::Charset::Code::BEGIN@6 at line 6 of MARC/Charset/Code.pm # once (61µs+2µs) by MARC::File::XML::BEGIN@12 at line 12 of MARC/File/XML.pm # once (54µs+2µs) by MARC::Batch::BEGIN@28 at line 28 of MARC/Batch.pm # once (53µs+2µs) by XML::SAX::ParserFactory::BEGIN@10 at line 10 of XML/SAX/ParserFactory.pm # once (49µs+2µs) by MARC::File::XML::BEGIN@14 at line 14 of MARC/File/XML.pm # once (49µs+1µs) by MARC::Charset::Code::BEGIN@7 at line 7 of MARC/Charset/Code.pm # once (45µs+0s) by MARC::File::SAX::BEGIN@10 at line 10 of MARC/File/SAX.pm # once (44µs+0s) by MARC::File::XML::BEGIN@7 at line 7 of MARC/File/XML.pm # once (41µs+0s) by main::BEGIN@4 at line 4 of conv.pl # once (40µs+0s) by MARC::Record::BEGIN@26 at line 26 of MARC/Record.pm # once (37µs+0s) by MARC::File::SAX::BEGIN@13 at line 13 of MARC/File/SAX.pm
sub import {
325282µs my $pkg = shift;
335292µs my $callpkg = caller($ExportLevel);
34
355271µs if ($pkg eq "Exporter" and @_ and $_[0] eq "import") {
36 *{$callpkg."::import"} = \&import;
37 return;
38 }
39
40 # We *need* to treat @{"$pkg\::EXPORT_FAIL"} since Carp uses it :-(
4152276µs my($exports, $fail) = (\@{"$pkg\::EXPORT"}, \@{"$pkg\::EXPORT_FAIL"});
425298µs return export $pkg, $callpkg, @_
43 if $Verbose or $Debug or @$fail > 1;
4452104µs my $export_cache = ($Cache{$pkg} ||= {});
4552410µs my $args = @_ or @_ = @$exports;
46
475256µs local $_;
485297µs if ($args and not %$export_cache) {
49 s/^&//, $export_cache->{$_} = 1
50241.51ms269303µs foreach (@$exports, @{"$pkg\::EXPORT_OK"});
# spent 303µs making 269 calls to Exporter::CORE:subst, avg 1µs/call
51 }
525251µs my $heavy;
53 # Try very hard not to use {} and hence have to enter scope on the foreach
54 # We bomb out of the loop with last as soon as heavy is set.
5552125µs if ($args or $fail) {
56 ($heavy = (/\W/ or $args and not exists $export_cache->{$_}
57 or @$fail and $_ eq $fail->[0])) and last
581042.08ms343447µs foreach (@_);
# spent 447µs making 343 calls to Exporter::CORE:match, avg 1µs/call
59 } else {
60 ($heavy = /\W/) and last
61 foreach (@_);
62 }
6352151µs52.38ms return export $pkg, $callpkg, ($args ? @_ : ()) if $heavy;
# spent 2.38ms making 5 calls to Exporter::export, avg 476µs/call
64 local $SIG{__WARN__} =
6547344µs sub {require Carp; &Carp::carp};
66 # shortcut for the common case of no type character
67941.59ms *{"$callpkg\::$_"} = \&{"$pkg\::$_"} foreach @_;
68}
69
70# Default methods
71
72sub export_fail {
73 my $self = shift;
74 @_;
75}
76
77# Unfortunately, caller(1)[3] "does not work" if the caller is aliased as
78# *name = \&foo. Thus the need to create a lot of identical subroutines
79# Otherwise we could have aliased them to export().
80
81sub export_to_level {
82 goto &{as_heavy()};
83}
84
85sub export_tags {
86 goto &{as_heavy()};
87}
88
89sub export_ok_tags {
90 goto &{as_heavy()};
91}
92
93sub require_version {
94 goto &{as_heavy()};
95}
96
9718µs1;
98__END__
 
# spent 447µs within Exporter::CORE:match which was called 343 times, avg 1µs/call: # 343 times (447µs+0s) by Exporter::import at line 58, avg 1µs/call
sub Exporter::CORE:match; # opcode
# spent 328µs within Exporter::CORE:subst which was called 276 times, avg 1µs/call: # 269 times (303µs+0s) by Exporter::import at line 50, avg 1µs/call # 7 times (25µs+0s) by Exporter::as_heavy at line 23, avg 4µs/call
sub Exporter::CORE:subst; # opcode