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

Filename/home/ss5/perl5/perlbrew/perls/perl-5.14.1/lib/site_perl/5.14.1/YAML/Any.pm
StatementsExecuted 111 statements in 8.17ms
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
2215.69ms146msYAML::Any::::implementationYAML::Any::implementation
111308µs593µsYAML::Any::::DumpYAML::Any::Dump
111136µs150msYAML::Any::::LoadYAML::Any::Load
11164µs79µsYAML::Any::::BEGIN@5YAML::Any::BEGIN@5
21137µs37µsYAML::Any::::CORE:substYAML::Any::CORE:subst (opcode)
11130µs130µsYAML::Any::::BEGIN@49YAML::Any::BEGIN@49
11126µs61µsYAML::Any::::BEGIN@61YAML::Any::BEGIN@61
11125µs59µsYAML::Any::::BEGIN@85YAML::Any::BEGIN@85
11125µs59µsYAML::Any::::BEGIN@73YAML::Any::BEGIN@73
21119µs19µsYAML::Any::::orderYAML::Any::order
11114µs14µsYAML::Any::::BEGIN@6YAML::Any::BEGIN@6
0000s0sYAML::Any::::DumpFileYAML::Any::DumpFile
0000s0sYAML::Any::::LoadFileYAML::Any::LoadFile
0000s0sYAML::Any::::croakYAML::Any::croak
0000s0sYAML::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
1package YAML::Any;
2
313µsour $VERSION = '0.80';
4
52104µs295µ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
62555µs114µ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
8128µs@YAML::Any::ISA = 'Exporter';
914µs@YAML::Any::EXPORT = qw(Dump Load);
1013µs@YAML::Any::EXPORT_OK = qw(DumpFile LoadFile);
11
12110µsmy @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
3013µsmy @load_options = qw(
31 UseCode
32 LoadCode
33);
34
3514µsmy @implementations = qw(
36 YAML::XS
37 YAML::Syck
38 YAML::Old
39 YAML
40 YAML::Tiny
41);
42
43sub 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 {
492446µs2229µ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
503267µs168µs my $implementation = __PACKAGE__->implementation;
# spent 68µs making 1 call to YAML::Any::implementation
51 for my $option (@dump_options) {
5260256µs my $var = "$implementation\::$option";
53 my $value = $$var;
54 local $$var;
55 $$var = defined $value ? $value : ${"YAML::$option"};
56 }
571218µs return &{"$implementation\::Dump"}(@_);
# spent 218µs making 1 call to YAML::XS::LibYAML::Dump
58}
59
60sub DumpFile {
612426µs297µ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 {
732383µs294µ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
7434.14ms1146ms my $implementation = __PACKAGE__->implementation;
# spent 146ms making 1 call to YAML::Any::implementation
75 for my $option (@load_options) {
76848µs my $var = "$implementation\::$option";
77 my $value = $$var;
78 local $$var;
79 $$var = defined $value ? $value : ${"YAML::$option"};
80 }
8114.07ms return &{"$implementation\::Load"}(@_);
# spent 4.07ms making 1 call to YAML::XS::LibYAML::Load
82}
83
84sub LoadFile {
8521.18ms292µ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
98441µ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 {
103424µs219µs my @order = __PACKAGE__->order;
# spent 19µs making 2 calls to YAML::Any::order, avg 10µs/call
104 for my $module (@order) {
1059207µs my $path = $module;
106237µ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
114sub croak {
115 require Carp;
116 Carp::Croak(@_);
117}
118
119132µs1;
120
121=head1 NAME
122
123YAML::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
133There are several YAML implementations that support the Dump/Load API.
134This module selects the best one available and uses it.
135
136=head1 ORDER
137
138Currently, YAML::Any will choose the first one of these YAML
139implementations 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
149If you specify an option like:
150
151 $YAML::Indent = 4;
152
153And YAML::Any is using YAML::XS, it will use the proper variable:
154$YAML::XS::Indent.
155
156=head1 SUBROUTINES
157
158Like all the YAML modules that YAML::Any uses, the following subroutines
159are exported by default:
160
161 Dump
162 Load
163
164and the following subroutines are exportable by request:
165
166 DumpFile
167 LoadFile
168
169=head1 METHODS
170
171YAML::Any provides the following class methods.
172
173=over
174
175=item YAML::Any->order;
176
177This method returns a list of the current possible implementations that
178YAML::Any will search for.
179
180=item YAML::Any->implementation;
181
182This method returns the implementation the YAML::Any will use. This
183result is obtained by finding the first member of YAML::Any->order that
184is either already loaded in C<%INC> or that can be loaded using
185C<require>. If no implementation is found, an error will be thrown.
186
187=back
188
189=head1 AUTHOR
190
191Ingy döt Net <ingy@cpan.org>
192
193=head1 COPYRIGHT
194
195Copyright (c) 2008. Ingy döt Net.
196
197This program is free software; you can redistribute it and/or modify it
198under the same terms as Perl itself.
199
200See 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