← 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 17:10:45 2013
Reported on Tue Oct 15 17:11:24 2013

Filename/usr/lib/perl5/YAML/Syck.pm
StatementsExecuted 31 statements in 2.57ms
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
111703µs703µsYAML::Syck::::LoadYAMLYAML::Syck::LoadYAML (xsub)
311307µs307µsYAML::Syck::::DumpYAMLYAML::Syck::DumpYAML (xsub)
11153µs113µsYAML::Syck::::BEGIN@36YAML::Syck::BEGIN@36
31143µs350µsYAML::Syck::::DumpYAML::Syck::Dump
11133µs269µsYAML::Syck::::BEGIN@15YAML::Syck::BEGIN@15
11123µs30µsYAML::Syck::::BEGIN@4YAML::Syck::BEGIN@4
11120µs20µsYAML::Syck::::BEGIN@12YAML::Syck::BEGIN@12
11117µs58µsYAML::Syck::::BEGIN@13YAML::Syck::BEGIN@13
11114µs209µsYAML::Syck::::BEGIN@5YAML::Syck::BEGIN@5
11114µs716µsYAML::Syck::::LoadYAML::Syck::Load
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
4368µs236µs
# spent 30µs (23+7) within YAML::Syck::BEGIN@4 which was called: # once (23µs+7µs) by Date::Manip::Lang::english::BEGIN@24 at line 4
use strict;
# spent 30µs making 1 call to YAML::Syck::BEGIN@4 # spent 7µs making 1 call to strict::import
51194µs
# spent 209µs (14+194) within YAML::Syck::BEGIN@5 which was called: # once (14µs+194µs) by Date::Manip::Lang::english::BEGIN@24 at line 11
use vars qw(
# spent 194µ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
11338µs1209µs);
# spent 209µs making 1 call to YAML::Syck::BEGIN@5
12338µs120µs
# spent 20µs within YAML::Syck::BEGIN@12 which was called: # once (20µs+0s) by Date::Manip::Lang::english::BEGIN@24 at line 12
use 5.006;
# spent 20µs making 1 call to YAML::Syck::BEGIN@12
133134µs299µs
# spent 58µs (17+41) within YAML::Syck::BEGIN@13 which was called: # once (17µs+41µs) by Date::Manip::Lang::english::BEGIN@24 at line 13
use Exporter;
# spent 58µs making 1 call to YAML::Syck::BEGIN@13 # spent 41µs making 1 call to Exporter::import
14
15
# spent 269µs (33+236) within YAML::Syck::BEGIN@15 which was called: # once (33µs+236µs) by Date::Manip::Lang::english::BEGIN@24 at line 34
BEGIN {
1610269µs $VERSION = '1.12';
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;
261236µs XSLoader::load(__PACKAGE__, $VERSION);
# spent 236µs making 1 call to XSLoader::load
27 1;
28 } or do {
29 require DynaLoader;
30 push @ISA, 'DynaLoader';
31 __PACKAGE__->bootstrap($VERSION);
32 };
33
341378µs1269µs}
# spent 269µs making 1 call to YAML::Syck::BEGIN@15
35
36
# spent 113µs (53+60) within YAML::Syck::BEGIN@36 which was called: # once (53µs+60µ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 },
533572µs2173µs};
# spent 113µs making 1 call to YAML::Syck::BEGIN@36 # spent 60µ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 350µs (43+307) within YAML::Syck::Dump which was called 3 times, avg 117µs/call: # 3 times (43µs+307µs) by CGI::Session::Serialize::yaml::freeze at line 18 of CGI/Session/Serialize/yaml.pm, avg 117µs/call
sub Dump {
663353µs3307µs $#_ ? join('', map { YAML::Syck::DumpYAML($_) } @_)
# spent 307µs making 3 calls to YAML::Syck::DumpYAML, avg 102µs/call
67 : YAML::Syck::DumpYAML($_[0]);
68}
69
70
# spent 716µs (14+703) within YAML::Syck::Load which was called: # once (14µs+703µs) by Date::Manip::Base::_language at line 35 of Date/Manip/Lang/english.pm
sub Load {
712718µs if (wantarray) {
72 my ($rv) = YAML::Syck::LoadYAML($_[0]);
73 @{$rv};
74 }
75 else {
761703µs YAML::Syck::LoadYAML($_[0]);
# spent 703µ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 307µs within YAML::Syck::DumpYAML which was called 3 times, avg 102µs/call: # 3 times (307µs+0s) by YAML::Syck::Dump at line 66, avg 102µs/call
sub YAML::Syck::DumpYAML; # xsub
# spent 703µs within YAML::Syck::LoadYAML which was called: # once (703µs+0s) by YAML::Syck::Load at line 76
sub YAML::Syck::LoadYAML; # xsub