Profile of YAML/Syck.pm

← 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:10 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
Statements | Executed 36 statements in 7.02ms

Subroutines
Calls | P | F | Exclusive Time | Inclusive Time | Subroutine
--- | --- | --- | --- | --- | ---
5 | 1 | 1 | 458µs | 458µs | YAML::Syck::::LoadYAML::Syck::Load
1 | 1 | 1 | 128µs | 304µs | YAML::Syck::::BEGIN@36YAML::Syck::BEGIN@36
1 | 1 | 1 | 89µs | 880µs | YAML::Syck::::BEGIN@15YAML::Syck::BEGIN@15
1 | 1 | 1 | 67µs | 67µs | YAML::Syck::::BEGIN@12YAML::Syck::BEGIN@12
1 | 1 | 1 | 67µs | 84µs | YAML::Syck::::BEGIN@4YAML::Syck::BEGIN@4
1 | 1 | 1 | 31µs | 116µs | YAML::Syck::::BEGIN@13YAML::Syck::BEGIN@13
1 | 1 | 1 | 27µs | 704µs | YAML::Syck::::BEGIN@5YAML::Syck::BEGIN@5
5 | 1 | 1 | 21µs | 21µs | YAML::Syck::::LoadYAMLYAML::Syck::LoadYAML (xsub)
0 | 0 | 0 | 0s | 0s | YAML::Syck::::DumpYAML::Syck::Dump
0 | 0 | 0 | 0s | 0s | YAML::Syck::::DumpFileYAML::Syck::DumpFile
0 | 0 | 0 | 0s | 0s | YAML::Syck::::LoadFileYAML::Syck::LoadFile
0 | 0 | 0 | 0s | 0s | YAML::Syck::::__ANON__[:37]YAML::Syck::__ANON__[:37]
0 | 0 | 0 | 0s | 0s | YAML::Syck::::__ANON__[:38]YAML::Syck::__ANON__[:38]
0 | 0 | 0 | 0s | 0s | YAML::Syck::::__ANON__[:39]YAML::Syck::__ANON__[:39]
0 | 0 | 0 | 0s | 0s | YAML::Syck::::__ANON__[:40]YAML::Syck::__ANON__[:40]
0 | 0 | 0 | 0s | 0s | YAML::Syck::::__ANON__[:41]YAML::Syck::__ANON__[:41]
0 | 0 | 0 | 0s | 0s | YAML::Syck::::__ANON__[:42]YAML::Syck::__ANON__[:42]
0 | 0 | 0 | 0s | 0s | YAML::Syck::::__ANON__[:43]YAML::Syck::__ANON__[:43]
0 | 0 | 0 | 0s | 0s | YAML::Syck::::__ANON__[:44]YAML::Syck::__ANON__[:44]
0 | 0 | 0 | 0s | 0s | YAML::Syck::::__ANON__[:45]YAML::Syck::__ANON__[:45]
0 | 0 | 0 | 0s | 0s | YAML::Syck::::__ANON__[:46]YAML::Syck::__ANON__[:46]
0 | 0 | 0 | 0s | 0s | YAML::Syck::::__ANON__[:47]YAML::Syck::__ANON__[:47]
0 | 0 | 0 | 0s | 0s | YAML::Syck::::__ANON__[:48]YAML::Syck::__ANON__[:48]
0 | 0 | 0 | 0s | 0s | YAML::Syck::::__ANON__[:49]YAML::Syck::__ANON__[:49]
0 | 0 | 0 | 0s | 0s | YAML::Syck::::__ANON__[:50]YAML::Syck::__ANON__[:50]
0 | 0 | 0 | 0s | 0s | YAML::Syck::::__ANON__[:51]YAML::Syck::__ANON__[:51]
0 | 0 | 0 | 0s | 0s | YAML::Syck::::__ANON__[:52]YAML::Syck::__ANON__[:52]
0 | 0 | 0 | 0s | 0s | YAML::Syck::::__qr_helperYAML::Syck::__qr_helper
0 | 0 | 0 | 0s | 0s | YAML::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
--- | --- | --- | --- | --- | ---
1 |  |  |  |  | package YAML::Syck;
2 |  |  |  |  | # See documentation after the __END__ mark.
3 |  |  |  |  |
4 | 2 | 173µs | 2 | 102µ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
5 | 1 | 22µs | 1 | 677µ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
11 | 1 | 89µs | 1 | 704µs | ); # spent 704µs making 1 call to YAML::Syck::BEGIN@5
12 | 2 | 294µs | 1 | 67µ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
13 | 2 | 453µs | 2 | 201µ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 {
16 | 1 | 2µs |  |  | $VERSION = '1.20';
17 | 1 | 6µs |  |  | @EXPORT = qw( Dump Load DumpFile LoadFile );
18 | 1 | 24µs |  |  | @ISA = qw( Exporter );
19 |  |  |  |  |
20 | 1 | 1µs |  |  | $SortKeys = 1;
21 | 1 | 700ns |  |  | $LoadBlessed = 1;
22 |  |  |  |  |
23 | 1 | 1µs |  |  | local $@;
24 |  |  |  |  | eval {
25 | 1 | 1µs |  |  | require XSLoader;
26 | 1 | 825µs | 1 | 792µs | XSLoader::load(__PACKAGE__, $VERSION); # spent 792µs making 1 call to XSLoader::load
27 | 1 | 4µs |  |  | 1;
28 | 1 | 17µs |  |  | } or do {
29 |  |  |  |  | require DynaLoader;
30 |  |  |  |  | push @ISA, 'DynaLoader';
31 |  |  |  |  | __PACKAGE__->bootstrap($VERSION);
32 |  |  |  |  | };
33 |  |  |  |  |
34 | 1 | 1.47ms | 1 | 880µ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 },
53 | 2 | 2.20ms | 2 | 480µs | }; # spent 304µs making 1 call to YAML::Syck::BEGIN@36 # spent 176µs making 1 call to constant::import
54 |  |  |  |  |
55 |  |  |  |  | sub __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 |  |  |  |  |
65 |  |  |  |  | sub 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 {
71 | 5 | 12µs |  |  | if (wantarray) {
72 |  |  |  |  | my ($rv) = YAML::Syck::LoadYAML($_[0]);
73 |  |  |  |  | @{$rv};
74 |  |  |  |  | }
75 |  |  |  |  | else {
76 | 5 | 122µs |  |  | @_ = $_[0];
77 | 5 | 1.29ms | 5 | 21µs | goto &YAML::Syck::LoadYAML; # spent 21µs making 5 calls to YAML::Syck::LoadYAML, avg 4µs/call
78 |  |  |  |  | }
79 |  |  |  |  | }
80 |  |  |  |  |
81 |  |  |  |  | sub _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 |  |  |  |  |
91 |  |  |  |  | sub 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 |  |  |  |  |
113 |  |  |  |  | sub 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 |  |  |  |  |
127 | 1 | 12µs |  |  | 1;
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