← Index
NYTProf Performance Profile   « block view • line view • sub view »
For /usr/share/koha/opac/cgi-bin/opac/opac-search.pl
  Run on Tue Oct 15 11:58:52 2013
Reported on Tue Oct 15 12:02:10 2013

Filename/usr/lib/perl5/YAML/Syck.pm
StatementsExecuted 31 statements in 2.68ms
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
111643µs643µsYAML::Syck::::LoadYAMLYAML::Syck::LoadYAML (xsub)
311395µs395µsYAML::Syck::::DumpYAMLYAML::Syck::DumpYAML (xsub)
11148µs133µsYAML::Syck::::BEGIN@36YAML::Syck::BEGIN@36
31141µs436µsYAML::Syck::::DumpYAML::Syck::Dump
11134µs305µsYAML::Syck::::BEGIN@15YAML::Syck::BEGIN@15
11131µs31µsYAML::Syck::::BEGIN@12YAML::Syck::BEGIN@12
11122µs29µsYAML::Syck::::BEGIN@4YAML::Syck::BEGIN@4
11118µs661µsYAML::Syck::::LoadYAML::Syck::Load
11115µs59µsYAML::Syck::::BEGIN@13YAML::Syck::BEGIN@13
11114µs231µsYAML::Syck::::BEGIN@5YAML::Syck::BEGIN@5
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_openhandleYAML::Syck::_is_openhandle
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
43105µs236µs
# spent 29µs (22+7) within YAML::Syck::BEGIN@4 which was called: # once (22µs+7µs) by Date::Manip::Lang::english::BEGIN@24 at line 4
use strict;
# spent 29µs making 1 call to YAML::Syck::BEGIN@4 # spent 7µs making 1 call to strict::import
5111µs1217µs
# spent 231µs (14+217) within YAML::Syck::BEGIN@5 which was called: # once (14µs+217µs) by Date::Manip::Lang::english::BEGIN@24 at line 11
use vars qw(
# spent 217µ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
11227µs1231µs);
# spent 231µs making 1 call to YAML::Syck::BEGIN@5
12350µs131µs
# spent 31µs within YAML::Syck::BEGIN@12 which was called: # once (31µs+0s) by Date::Manip::Lang::english::BEGIN@24 at line 12
use 5.006;
# spent 31µs making 1 call to YAML::Syck::BEGIN@12
133135µs2103µs
# spent 59µs (15+44) within YAML::Syck::BEGIN@13 which was called: # once (15µs+44µs) by Date::Manip::Lang::english::BEGIN@24 at line 13
use Exporter;
# spent 59µs making 1 call to YAML::Syck::BEGIN@13 # spent 44µs making 1 call to Exporter::import
14
15
# spent 305µs (34+270) within YAML::Syck::BEGIN@15 which was called: # once (34µs+270µs) by Date::Manip::Lang::english::BEGIN@24 at line 34
BEGIN {
161600ns $VERSION = '1.12';
1711µs @EXPORT = qw( Dump Load DumpFile LoadFile );
18112µs @ISA = qw( Exporter );
19
201300ns $SortKeys = 1;
211200ns $LoadBlessed = 1;
22
231300ns local $@;
24 eval {
2511µs require XSLoader;
261282µs1270µs XSLoader::load(__PACKAGE__, $VERSION);
# spent 270µs making 1 call to XSLoader::load
2711µs 1;
2816µs } or do {
29 require DynaLoader;
30 push @ISA, 'DynaLoader';
31 __PACKAGE__->bootstrap($VERSION);
32 };
33
341354µs1305µs}
# spent 305µs making 1 call to YAML::Syck::BEGIN@15
35
36
# spent 133µs (48+85) within YAML::Syck::BEGIN@36 which was called: # once (48µs+85µs) by Date::Manip::Lang::english::BEGIN@24 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 },
533587µs2218µs};
# spent 133µs making 1 call to YAML::Syck::BEGIN@36 # spent 85µ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
65
# spent 436µs (41+395) within YAML::Syck::Dump which was called 3 times, avg 145µs/call: # 3 times (41µs+395µs) by CGI::Session::Serialize::yaml::freeze at line 18 of CGI/Session/Serialize/yaml.pm, avg 145µs/call
sub Dump {
663438µs3395µs $#_ ? join('', map { YAML::Syck::DumpYAML($_) } @_)
# spent 395µs making 3 calls to YAML::Syck::DumpYAML, avg 132µs/call
67 : YAML::Syck::DumpYAML($_[0]);
68}
69
70
# spent 661µs (18+643) within YAML::Syck::Load which was called: # once (18µs+643µs) by Date::Manip::Base::_language at line 35 of Date/Manip/Lang/english.pm
sub Load {
7119µs if (wantarray) {
72 my ($rv) = YAML::Syck::LoadYAML($_[0]);
73 @{$rv};
74 }
75 else {
761657µs1643µs YAML::Syck::LoadYAML($_[0]);
# spent 643µs making 1 call to YAML::Syck::LoadYAML
77 }
78}
79
80# NOTE. The code below (_is_openhandle) avoids to require/load
81# Scalar::Util unless it is given a ref or glob
82# as an argument. That is purposeful, so to avoid
83# the need for this dependency unless strictly necessary.
84# If that was not the case, Scalar::Util::openhandle could
85# be used directly.
86
87sub _is_openhandle {
88 my $h = shift;
89 if ( ref($h) || ref(\$h) eq 'GLOB' ) {
90 require Scalar::Util;
91 return Scalar::Util::openhandle($h);
92 } else {
93 return undef;
94 }
95}
96
97sub DumpFile {
98 my $file = shift;
99 if ( _is_openhandle($file) ) {
100 if ($#_) {
101 print {$file} YAML::Syck::DumpYAML($_) for @_;
102 }
103 else {
104 print {$file} YAML::Syck::DumpYAML($_[0]);
105 }
106 }
107 else {
108 open(my $fh, '>', $file) or die "Cannot write to $file: $!";
109 if ($#_) {
110 print {$fh} YAML::Syck::DumpYAML($_) for @_;
111 }
112 else {
113 print {$fh} YAML::Syck::DumpYAML($_[0]);
114 }
115 close $fh;
116 }
117}
118
119sub LoadFile {
120 my $file = shift;
121 if ( _is_openhandle($file) ) {
122 if( -z $file ) {
123 die("Cannot load an empty file");
124 };
125 Load(do { local $/; <$file> });
126 }
127 else {
128 if(!-e $file || -z $file) {
129 die("'$file' is empty or non-existant");
130 }
131 open(my $fh, '<', $file) or die "Cannot read from $file: $!";
132 Load(do { local $/; <$fh> });
133 }
134}
135
13614µs1;
137
138__END__
 
# spent 395µs within YAML::Syck::DumpYAML which was called 3 times, avg 132µs/call: # 3 times (395µs+0s) by YAML::Syck::Dump at line 66, avg 132µs/call
sub YAML::Syck::DumpYAML; # xsub
# spent 643µs within YAML::Syck::LoadYAML which was called: # once (643µs+0s) by YAML::Syck::Load at line 76
sub YAML::Syck::LoadYAML; # xsub