← 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:04 2012

Filename/home/ss5/perl5/perlbrew/perls/perl-5.14.1/lib/site_perl/5.14.1/x86_64-linux-thread-multi/YAML/Syck.pm
StatementsExecuted 36 statements in 7.02ms
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
511458µs458µsYAML::Syck::::LoadYAML::Syck::Load
111128µs304µsYAML::Syck::::BEGIN@36YAML::Syck::BEGIN@36
11189µs880µsYAML::Syck::::BEGIN@15YAML::Syck::BEGIN@15
11167µs67µsYAML::Syck::::BEGIN@12YAML::Syck::BEGIN@12
11167µs84µsYAML::Syck::::BEGIN@4YAML::Syck::BEGIN@4
11131µs116µsYAML::Syck::::BEGIN@13YAML::Syck::BEGIN@13
11127µs704µsYAML::Syck::::BEGIN@5YAML::Syck::BEGIN@5
51121µs21µsYAML::Syck::::LoadYAMLYAML::Syck::LoadYAML (xsub)
0000s0sYAML::Syck::::DumpYAML::Syck::Dump
0000s0sYAML::Syck::::DumpFileYAML::Syck::DumpFile
0000s0sYAML::Syck::::LoadFileYAML::Syck::LoadFile
0000s0sYAML::Syck::::__ANON__[:37]YAML::Syck::__ANON__[:37]
0000s0sYAML::Syck::::__ANON__[:38]YAML::Syck::__ANON__[:38]
0000s0sYAML::Syck::::__ANON__[:39]YAML::Syck::__ANON__[:39]
0000s0sYAML::Syck::::__ANON__[:40]YAML::Syck::__ANON__[:40]
0000s0sYAML::Syck::::__ANON__[:41]YAML::Syck::__ANON__[:41]
0000s0sYAML::Syck::::__ANON__[:42]YAML::Syck::__ANON__[:42]
0000s0sYAML::Syck::::__ANON__[:43]YAML::Syck::__ANON__[:43]
0000s0sYAML::Syck::::__ANON__[:44]YAML::Syck::__ANON__[:44]
0000s0sYAML::Syck::::__ANON__[:45]YAML::Syck::__ANON__[:45]
0000s0sYAML::Syck::::__ANON__[:46]YAML::Syck::__ANON__[:46]
0000s0sYAML::Syck::::__ANON__[:47]YAML::Syck::__ANON__[:47]
0000s0sYAML::Syck::::__ANON__[:48]YAML::Syck::__ANON__[:48]
0000s0sYAML::Syck::::__ANON__[:49]YAML::Syck::__ANON__[:49]
0000s0sYAML::Syck::::__ANON__[:50]YAML::Syck::__ANON__[:50]
0000s0sYAML::Syck::::__ANON__[:51]YAML::Syck::__ANON__[:51]
0000s0sYAML::Syck::::__ANON__[:52]YAML::Syck::__ANON__[:52]
0000s0sYAML::Syck::::__qr_helperYAML::Syck::__qr_helper
0000s0sYAML::Syck::::_is_globYAML::Syck::_is_glob
Call graph for these subroutines as a Graphviz dot language file.
Line State
ments
Time
on line
Calls Time
in subs
Code
1package YAML::Syck;
2# See documentation after the __END__ mark.
3
42173µs2102µs
# spent 84µs (67+18) within YAML::Syck::BEGIN@4 which was called: # once (67µs+18µs) by main::BEGIN@10 at line 4
use strict;
# spent 84µs making 1 call to YAML::Syck::BEGIN@4 # spent 18µs making 1 call to strict::import
51677µs
# spent 704µs (27+677) within YAML::Syck::BEGIN@5 which was called: # once (27µs+677µs) by main::BEGIN@10 at line 11
use vars qw(
# spent 677µs making 1 call to vars::import
6 @ISA @EXPORT $VERSION
7 $Headless $SortKeys $SingleQuote
8 $ImplicitBinary $ImplicitTyping $ImplicitUnicode
9 $UseCode $LoadCode $DumpCode
10 $DeparseObject $LoadBlessed
112111µs1704µs);
# spent 704µs making 1 call to YAML::Syck::BEGIN@5
122294µs167µs
# spent 67µs within YAML::Syck::BEGIN@12 which was called: # once (67µs+0s) by main::BEGIN@10 at line 12
use 5.006;
# spent 67µs making 1 call to YAML::Syck::BEGIN@12
132453µs2201µs
# spent 116µs (31+85) within YAML::Syck::BEGIN@13 which was called: # once (31µs+85µs) by main::BEGIN@10 at line 13
use Exporter;
# spent 116µs making 1 call to YAML::Syck::BEGIN@13 # spent 85µs making 1 call to Exporter::import
14
15
# spent 880µs (89+792) within YAML::Syck::BEGIN@15 which was called: # once (89µs+792µs) by main::BEGIN@10 at line 34
BEGIN {
16752µs $VERSION = '1.20';
17 @EXPORT = qw( Dump Load DumpFile LoadFile );
18 @ISA = qw( Exporter );
19
20 $SortKeys = 1;
21 $LoadBlessed = 1;
22
23 local $@;
24 eval {
25 require XSLoader;
261792µs XSLoader::load(__PACKAGE__, $VERSION);
# spent 792µs making 1 call to XSLoader::load
27 1;
283830µs } or do {
29 require DynaLoader;
30 push @ISA, 'DynaLoader';
31 __PACKAGE__->bootstrap($VERSION);
32 };
33
3411.47ms1880µs}
# spent 880µs making 1 call to YAML::Syck::BEGIN@15
35
36
# spent 304µs (128+176) within YAML::Syck::BEGIN@36 which was called: # once (128µs+176µs) by main::BEGIN@10 at line 53
use constant QR_MAP => {
37 '' => sub { qr{$_[0]} },
38 x => sub { qr{$_[0]}x },
39 i => sub { qr{$_[0]}i },
40 s => sub { qr{$_[0]}s },
41 m => sub { qr{$_[0]}m },
42 ix => sub { qr{$_[0]}ix },
43 sx => sub { qr{$_[0]}sx },
44 mx => sub { qr{$_[0]}mx },
45 si => sub { qr{$_[0]}si },
46 mi => sub { qr{$_[0]}mi },
47 ms => sub { qr{$_[0]}sm },
48 six => sub { qr{$_[0]}six },
49 mix => sub { qr{$_[0]}mix },
50 msx => sub { qr{$_[0]}msx },
51 msi => sub { qr{$_[0]}msi },
52 msix => sub { qr{$_[0]}msix },
5322.20ms2480µs};
# spent 304µs making 1 call to YAML::Syck::BEGIN@36 # spent 176µs making 1 call to constant::import
54
55sub __qr_helper {
56 if ($_[0] =~ /\A \(\? ([ixsm]*) (?:- (?:[ixsm]*))? : (.*) \) \z/x) {
57 my $sub = QR_MAP()->{$1} || QR_MAP()->{''};
58 &$sub($2);
59 }
60 else {
61 qr/$_[0]/;
62 }
63}
64
65sub Dump {
66 $#_ ? join('', map { YAML::Syck::DumpYAML($_) } @_)
67 : YAML::Syck::DumpYAML($_[0]);
68}
69
70
# spent 458µs within YAML::Syck::Load which was called 5 times, avg 92µs/call: # 5 times (458µs+0s) by main::check at line 28 of t/app_dpath.t, avg 92µs/call
sub Load {
71151.43ms if (wantarray) {
72 my ($rv) = YAML::Syck::LoadYAML($_[0]);
73 @{$rv};
74 }
75 else {
76 @_ = $_[0];
77521µs goto &YAML::Syck::LoadYAML;
# spent 21µs making 5 calls to YAML::Syck::LoadYAML, avg 4µs/call
78 }
79}
80
81sub _is_glob {
82 my $h = shift;
83
84 return 1 if(ref($h) eq 'GLOB');
85 return 1 if(ref(\$h) eq 'GLOB');
86 return 1 if(ref($h) =~ m/^IO::/);
87
88 return;
89}
90
91sub DumpFile {
92 my $file = shift;
93 if ( _is_glob($file) ) {
94 if ($#_) {
95 print {$file} YAML::Syck::DumpYAML($_) for @_;
96 }
97 else {
98 print {$file} YAML::Syck::DumpYAML($_[0]);
99 }
100 }
101 else {
102 open(my $fh, '>', $file) or die "Cannot write to $file: $!";
103 if ($#_) {
104 print {$fh} YAML::Syck::DumpYAML($_) for @_;
105 }
106 else {
107 print {$fh} YAML::Syck::DumpYAML($_[0]);
108 }
109 close $fh;
110 }
111}
112
113sub LoadFile {
114 my $file = shift;
115 if ( _is_glob($file) ) {
116 Load(do { local $/; <$file> });
117 }
118 else {
119 if(!-e $file || -z $file) {
120 die("'$file' is empty or non-existant");
121 }
122 open(my $fh, '<', $file) or die "Cannot read from $file: $!";
123 Load(do { local $/; <$fh> });
124 }
125}
126
127112µs1;
128
129__END__
 
# spent 21µs within YAML::Syck::LoadYAML which was called 5 times, avg 4µs/call: # 5 times (21µs+0s) by main::check at line 77, avg 4µs/call
sub YAML::Syck::LoadYAML; # xsub