Profile of YAML/Any.pm

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

Filename | /home/ss5/perl5/perlbrew/perls/perl-5.14.1/lib/site_perl/5.14.1/YAML/Any.pm
Statements | Executed 111 statements in 8.17ms

Subroutines
Calls | P | F | Exclusive Time | Inclusive Time | Subroutine
--- | --- | --- | --- | --- | ---
2 | 2 | 1 | 5.69ms | 146ms | YAML::Any::::implementationYAML::Any::implementation
1 | 1 | 1 | 308µs | 593µs | YAML::Any::::DumpYAML::Any::Dump
1 | 1 | 1 | 136µs | 150ms | YAML::Any::::LoadYAML::Any::Load
1 | 1 | 1 | 64µs | 79µs | YAML::Any::::BEGIN@5YAML::Any::BEGIN@5
2 | 1 | 1 | 37µs | 37µs | YAML::Any::::CORE:substYAML::Any::CORE:subst (opcode)
1 | 1 | 1 | 30µs | 130µs | YAML::Any::::BEGIN@49YAML::Any::BEGIN@49
1 | 1 | 1 | 26µs | 61µs | YAML::Any::::BEGIN@61YAML::Any::BEGIN@61
1 | 1 | 1 | 25µs | 59µs | YAML::Any::::BEGIN@85YAML::Any::BEGIN@85
1 | 1 | 1 | 25µs | 59µs | YAML::Any::::BEGIN@73YAML::Any::BEGIN@73
2 | 1 | 1 | 19µs | 19µs | YAML::Any::::orderYAML::Any::order
1 | 1 | 1 | 14µs | 14µs | YAML::Any::::BEGIN@6YAML::Any::BEGIN@6
0 | 0 | 0 | 0s | 0s | YAML::Any::::DumpFileYAML::Any::DumpFile
0 | 0 | 0 | 0s | 0s | YAML::Any::::LoadFileYAML::Any::LoadFile
0 | 0 | 0 | 0s | 0s | YAML::Any::::croakYAML::Any::croak
0 | 0 | 0 | 0s | 0s | YAML::Any::::importYAML::Any::import

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::Any;
2 |  |  |  |  |
3 | 1 | 3µs |  |  | our $VERSION = '0.80';
4 |  |  |  |  |
5 | 2 | 104µs | 2 | 95µs | # spent 79µs (64+16) within YAML::Any::BEGIN@5 which was called: # once (64µs+16µs) by main::_read_in at line 5 use strict; # spent 79µs making 1 call to YAML::Any::BEGIN@5 # spent 16µs making 1 call to strict::import
6 | 2 | 555µs | 1 | 14µs | # spent 14µs within YAML::Any::BEGIN@6 which was called: # once (14µs+0s) by main::_read_in at line 6 use Exporter (); # spent 14µs making 1 call to YAML::Any::BEGIN@6
7 |  |  |  |  |
8 | 1 | 28µs |  |  | @YAML::Any::ISA = 'Exporter';
9 | 1 | 4µs |  |  | @YAML::Any::EXPORT = qw(Dump Load);
10 | 1 | 3µs |  |  | @YAML::Any::EXPORT_OK = qw(DumpFile LoadFile);
11 |  |  |  |  |
12 | 1 | 10µs |  |  | my @dump_options = qw(
13 |  |  |  |  | UseCode
14 |  |  |  |  | DumpCode
15 |  |  |  |  | SpecVersion
16 |  |  |  |  | Indent
17 |  |  |  |  | UseHeader
18 |  |  |  |  | UseVersion
19 |  |  |  |  | SortKeys
20 |  |  |  |  | AnchorPrefix
21 |  |  |  |  | UseBlock
22 |  |  |  |  | UseFold
23 |  |  |  |  | CompressSeries
24 |  |  |  |  | InlineSeries
25 |  |  |  |  | UseAliases
26 |  |  |  |  | Purity
27 |  |  |  |  | Stringify
28 |  |  |  |  | );
29 |  |  |  |  |
30 | 1 | 3µs |  |  | my @load_options = qw(
31 |  |  |  |  | UseCode
32 |  |  |  |  | LoadCode
33 |  |  |  |  | );
34 |  |  |  |  |
35 | 1 | 4µs |  |  | my @implementations = qw(
36 |  |  |  |  | YAML::XS
37 |  |  |  |  | YAML::Syck
38 |  |  |  |  | YAML::Old
39 |  |  |  |  | YAML
40 |  |  |  |  | YAML::Tiny
41 |  |  |  |  | );
42 |  |  |  |  |
43 |  |  |  |  | sub import {
44 |  |  |  |  | __PACKAGE__->implementation;
45 |  |  |  |  | goto &Exporter::import;
46 |  |  |  |  | }
47 |  |  |  |  |
48 |  |  |  |  | # spent 593µs (308+285) within YAML::Any::Dump which was called: # once (308µs+285µs) by main::_write_out at line 275 of bin/dpath sub Dump {
49 | 2 | 446µs | 2 | 229µs | # spent 130µs (30+99) within YAML::Any::BEGIN@49 which was called: # once (30µs+99µs) by main::_read_in at line 49 no strict 'refs'; # spent 130µs making 1 call to YAML::Any::BEGIN@49 # spent 99µs making 1 call to strict::unimport
50 | 63 | 523µs | 1 | 68µs | my $implementation = __PACKAGE__->implementation; # spent 68µs making 1 call to YAML::Any::implementation
51 |  |  |  |  | for my $option (@dump_options) {
52 |  |  |  |  | my $var = "$implementation\::$option";
53 |  |  |  |  | my $value = $$var;
54 |  |  |  |  | local $$var;
55 |  |  |  |  | $$var = defined $value ? $value : ${"YAML::$option"};
56 |  |  |  |  | }
57 |  |  | 1 | 218µs | return &{"$implementation\::Dump"}(@_); # spent 218µs making 1 call to YAML::XS::LibYAML::Dump
58 |  |  |  |  | }
59 |  |  |  |  |
60 |  |  |  |  | sub DumpFile {
61 | 2 | 426µs | 2 | 97µs | # spent 61µs (26+35) within YAML::Any::BEGIN@61 which was called: # once (26µs+35µs) by main::_read_in at line 61 no strict 'refs'; # spent 61µs making 1 call to YAML::Any::BEGIN@61 # spent 35µs making 1 call to strict::unimport
62 |  |  |  |  | my $implementation = __PACKAGE__->implementation;
63 |  |  |  |  | for my $option (@dump_options) {
64 |  |  |  |  | my $var = "$implementation\::$option";
65 |  |  |  |  | my $value = $$var;
66 |  |  |  |  | local $$var;
67 |  |  |  |  | $$var = defined $value ? $value : ${"YAML::$option"};
68 |  |  |  |  | }
69 |  |  |  |  | return &{"$implementation\::DumpFile"}(@_);
70 |  |  |  |  | }
71 |  |  |  |  |
72 |  |  |  |  | # spent 150ms (136µs+150) within YAML::Any::Load which was called: # once (136µs+150ms) by main::_read_in at line 107 of bin/dpath sub Load {
73 | 2 | 383µs | 2 | 94µs | # spent 59µs (25+35) within YAML::Any::BEGIN@73 which was called: # once (25µs+35µs) by main::_read_in at line 73 no strict 'refs'; # spent 59µs making 1 call to YAML::Any::BEGIN@73 # spent 35µs making 1 call to strict::unimport
74 | 11 | 4.19ms | 1 | 146ms | my $implementation = __PACKAGE__->implementation; # spent 146ms making 1 call to YAML::Any::implementation
75 |  |  |  |  | for my $option (@load_options) {
76 |  |  |  |  | my $var = "$implementation\::$option";
77 |  |  |  |  | my $value = $$var;
78 |  |  |  |  | local $$var;
79 |  |  |  |  | $$var = defined $value ? $value : ${"YAML::$option"};
80 |  |  |  |  | }
81 |  |  | 1 | 4.07ms | return &{"$implementation\::Load"}(@_); # spent 4.07ms making 1 call to YAML::XS::LibYAML::Load
82 |  |  |  |  | }
83 |  |  |  |  |
84 |  |  |  |  | sub LoadFile {
85 | 2 | 1.18ms | 2 | 92µs | # spent 59µs (25+34) within YAML::Any::BEGIN@85 which was called: # once (25µs+34µs) by main::_read_in at line 85 no strict 'refs'; # spent 59µs making 1 call to YAML::Any::BEGIN@85 # spent 34µs making 1 call to strict::unimport
86 |  |  |  |  | my $implementation = __PACKAGE__->implementation;
87 |  |  |  |  | for my $option (@load_options) {
88 |  |  |  |  | my $var = "$implementation\::$option";
89 |  |  |  |  | my $value = $$var;
90 |  |  |  |  | local $$var;
91 |  |  |  |  | $$var = defined $value ? $value : ${"YAML::$option"};
92 |  |  |  |  | }
93 |  |  |  |  | return &{"$implementation\::LoadFile"}(@_);
94 |  |  |  |  | }
95 |  |  |  |  |
96 |  |  |  |  | # spent 19µs within YAML::Any::order which was called 2 times, avg 10µs/call: # 2 times (19µs+0s) by YAML::Any::implementation at line 103, avg 10µs/call sub order {
97 |  |  |  |  | return @YAML::Any::_TEST_ORDER
98 | 4 | 41µs |  |  | if defined @YAML::Any::_TEST_ORDER;
99 |  |  |  |  | return @implementations;
100 |  |  |  |  | }
101 |  |  |  |  |
102 |  |  |  |  | # spent 146ms (5.69+140) within YAML::Any::implementation which was called 2 times, avg 72.9ms/call: # once (5.65ms+140ms) by YAML::Any::Load at line 74 # once (40µs+28µs) by YAML::Any::Dump at line 50 sub implementation {
103 | 13 | 231µs | 2 | 19µs | my @order = __PACKAGE__->order; # spent 19µs making 2 calls to YAML::Any::order, avg 10µs/call
104 |  |  |  |  | for my $module (@order) {
105 |  |  |  |  | my $path = $module;
106 |  |  | 2 | 37µs | $path =~ s/::/\//g; # spent 37µs making 2 calls to YAML::Any::CORE:subst, avg 19µs/call
107 |  |  |  |  | $path .= '.pm';
108 |  |  |  |  | return $module if exists $INC{$path};
109 |  |  |  |  | eval "require $module; 1" and return $module; # spent 271µs executing statements in string eval
110 |  |  |  |  | }
111 |  |  |  |  | croak("YAML::Any couldn't find any of these YAML implementations: @order");
112 |  |  |  |  | }
113 |  |  |  |  |
114 |  |  |  |  | sub croak {
115 |  |  |  |  | require Carp;
116 |  |  |  |  | Carp::Croak(@_);
117 |  |  |  |  | }
118 |  |  |  |  |
119 | 1 | 32µs |  |  | 1;
120 |  |  |  |  |
121 |  |  |  |  | =head1 NAME
122 |  |  |  |  |
123 |  |  |  |  | YAML::Any - Pick a YAML implementation and use it.
124 |  |  |  |  |
125 |  |  |  |  | =head1 SYNOPSIS
126 |  |  |  |  |
127 |  |  |  |  | use YAML::Any;
128 |  |  |  |  | $YAML::Indent = 3;
129 |  |  |  |  | my $yaml = Dump(@objects);
130 |  |  |  |  |
131 |  |  |  |  | =head1 DESCRIPTION
132 |  |  |  |  |
133 |  |  |  |  | There are several YAML implementations that support the Dump/Load API.
134 |  |  |  |  | This module selects the best one available and uses it.
135 |  |  |  |  |
136 |  |  |  |  | =head1 ORDER
137 |  |  |  |  |
138 |  |  |  |  | Currently, YAML::Any will choose the first one of these YAML
139 |  |  |  |  | implementations that is installed on your system:
140 |  |  |  |  |
141 |  |  |  |  | YAML::XS
142 |  |  |  |  | YAML::Syck
143 |  |  |  |  | YAML::Old
144 |  |  |  |  | YAML
145 |  |  |  |  | YAML::Tiny
146 |  |  |  |  |
147 |  |  |  |  | =head1 OPTIONS
148 |  |  |  |  |
149 |  |  |  |  | If you specify an option like:
150 |  |  |  |  |
151 |  |  |  |  | $YAML::Indent = 4;
152 |  |  |  |  |
153 |  |  |  |  | And YAML::Any is using YAML::XS, it will use the proper variable:
154 |  |  |  |  | $YAML::XS::Indent.
155 |  |  |  |  |
156 |  |  |  |  | =head1 SUBROUTINES
157 |  |  |  |  |
158 |  |  |  |  | Like all the YAML modules that YAML::Any uses, the following subroutines
159 |  |  |  |  | are exported by default:
160 |  |  |  |  |
161 |  |  |  |  | Dump
162 |  |  |  |  | Load
163 |  |  |  |  |
164 |  |  |  |  | and the following subroutines are exportable by request:
165 |  |  |  |  |
166 |  |  |  |  | DumpFile
167 |  |  |  |  | LoadFile
168 |  |  |  |  |
169 |  |  |  |  | =head1 METHODS
170 |  |  |  |  |
171 |  |  |  |  | YAML::Any provides the following class methods.
172 |  |  |  |  |
173 |  |  |  |  | =over
174 |  |  |  |  |
175 |  |  |  |  | =item YAML::Any->order;
176 |  |  |  |  |
177 |  |  |  |  | This method returns a list of the current possible implementations that
178 |  |  |  |  | YAML::Any will search for.
179 |  |  |  |  |
180 |  |  |  |  | =item YAML::Any->implementation;
181 |  |  |  |  |
182 |  |  |  |  | This method returns the implementation the YAML::Any will use. This
183 |  |  |  |  | result is obtained by finding the first member of YAML::Any->order that
184 |  |  |  |  | is either already loaded in C<%INC> or that can be loaded using
185 |  |  |  |  | C<require>. If no implementation is found, an error will be thrown.
186 |  |  |  |  |
187 |  |  |  |  | =back
188 |  |  |  |  |
189 |  |  |  |  | =head1 AUTHOR
190 |  |  |  |  |
191 |  |  |  |  | Ingy döt Net <ingy@cpan.org>
192 |  |  |  |  |
193 |  |  |  |  | =head1 COPYRIGHT
194 |  |  |  |  |
195 |  |  |  |  | Copyright (c) 2008. Ingy döt Net.
196 |  |  |  |  |
197 |  |  |  |  | This program is free software; you can redistribute it and/or modify it
198 |  |  |  |  | under the same terms as Perl itself.
199 |  |  |  |  |
200 |  |  |  |  | See L<http://www.perl.com/perl/misc/Artistic.html>
201 |  |  |  |  |
202 |  |  |  |  | =cut
|  |  |  |  | # spent 37µs within YAML::Any::CORE:subst which was called 2 times, avg 19µs/call: # 2 times (37µs+0s) by YAML::Any::implementation at line 106, avg 19µs/call sub YAML::Any::CORE:subst; # opcode