Profile of YAML/XS.pm

← Index
NYTProf Performance Profile «line view»
For script/ponapi
Run on Wed Feb 10 15:51:26 2016
Reported on Thu Feb 11 09:43:11 2016

Filename | /usr/local/lib/perl/5.18.2/YAML/XS.pm
Statements | Executed 20 statements in 1.08ms

Subroutines
Calls | P | F | Exclusive Time | Inclusive Time | Subroutine
--- | --- | --- | --- | --- | ---
1 | 1 | 1 | 25.6ms | 31.7ms | YAML::XS::::BEGIN@56 YAML::XS::BEGIN@56
1 | 1 | 1 | 191µs | 509µs | YAML::XS::::BEGIN@19 YAML::XS::BEGIN@19
1 | 1 | 1 | 28µs | 74µs | YAML::XS::::BEGIN@101 YAML::XS::BEGIN@101
1 | 1 | 1 | 19µs | 22µs | PONAPI::Server::ConfigReader::::BEGIN@1.22PONAPI::Server::ConfigReader::BEGIN@1.22
1 | 1 | 1 | 10µs | 20µs | PONAPI::Server::ConfigReader::::BEGIN@1.21PONAPI::Server::ConfigReader::BEGIN@1.21
1 | 1 | 1 | 6µs | 70µs | YAML::XS::::BEGIN@6 YAML::XS::BEGIN@6
0 | 0 | 0 | 0s | 0s | YAML::XS::::DumpFile YAML::XS::DumpFile
0 | 0 | 0 | 0s | 0s | YAML::XS::::LoadFile YAML::XS::LoadFile
0 | 0 | 0 | 0s | 0s | YAML::XS::::__ANON__[:102] YAML::XS::__ANON__[:102]
0 | 0 | 0 | 0s | 0s | YAML::XS::::__ANON__[:103] YAML::XS::__ANON__[:103]
0 | 0 | 0 | 0s | 0s | YAML::XS::::__ANON__[:104] YAML::XS::__ANON__[:104]
0 | 0 | 0 | 0s | 0s | YAML::XS::::__ANON__[:105] YAML::XS::__ANON__[:105]
0 | 0 | 0 | 0s | 0s | YAML::XS::::__ANON__[:106] YAML::XS::__ANON__[:106]
0 | 0 | 0 | 0s | 0s | YAML::XS::::__ANON__[:107] YAML::XS::__ANON__[:107]
0 | 0 | 0 | 0s | 0s | YAML::XS::::__ANON__[:108] YAML::XS::__ANON__[:108]
0 | 0 | 0 | 0s | 0s | YAML::XS::::__ANON__[:109] YAML::XS::__ANON__[:109]
0 | 0 | 0 | 0s | 0s | YAML::XS::::__ANON__[:110] YAML::XS::__ANON__[:110]
0 | 0 | 0 | 0s | 0s | YAML::XS::::__ANON__[:111] YAML::XS::__ANON__[:111]
0 | 0 | 0 | 0s | 0s | YAML::XS::::__ANON__[:112] YAML::XS::__ANON__[:112]
0 | 0 | 0 | 0s | 0s | YAML::XS::::__ANON__[:113] YAML::XS::__ANON__[:113]
0 | 0 | 0 | 0s | 0s | YAML::XS::::__ANON__[:114] YAML::XS::__ANON__[:114]
0 | 0 | 0 | 0s | 0s | YAML::XS::::__ANON__[:115] YAML::XS::__ANON__[:115]
0 | 0 | 0 | 0s | 0s | YAML::XS::::__ANON__[:116] YAML::XS::__ANON__[:116]
0 | 0 | 0 | 0s | 0s | YAML::XS::::__ANON__[:117] YAML::XS::__ANON__[:117]
0 | 0 | 0 | 0s | 0s | YAML::XS::::__ANON__[:75] YAML::XS::__ANON__[:75]
0 | 0 | 0 | 0s | 0s | YAML::XS::::__ANON__[:99] YAML::XS::__ANON__[:99]
0 | 0 | 0 | 0s | 0s | YAML::XS::::__qr_loader YAML::XS::__qr_loader

Call graph for these subroutines as a Graphviz dot language file.

Line | State ments | Time on line | Calls | Time in subs | Code
--- | --- | --- | --- | --- | ---
1 | 4 | 68µs | 4 | 56µs | # spent 22µs (19+4) within PONAPI::Server::ConfigReader::BEGIN@1.22 which was called: # once (19µs+4µs) by PONAPI::Server::ConfigReader::BEGIN@8 at line 1 # spent 20µs (10+10) within PONAPI::Server::ConfigReader::BEGIN@1.21 which was called: # once (10µs+10µs) by PONAPI::Server::ConfigReader::BEGIN@8 at line 1 use strict; use warnings; # spent 22µs making 1 call to PONAPI::Server::ConfigReader::BEGIN@1.22 # spent 20µs making 1 call to PONAPI::Server::ConfigReader::BEGIN@1.21 # spent 10µs making 1 call to strict::import # spent 4µs making 1 call to warnings::import
2 |  |  |  |  |
3 |  |  |  |  | package YAML::XS;
4 | 1 | 500ns |  |  | our $VERSION = '0.47';
5 |  |  |  |  |
6 | 2 | 92µs | 2 | 133µs | # spent 70µs (6+63) within YAML::XS::BEGIN@6 which was called: # once (6µs+63µs) by PONAPI::Server::ConfigReader::BEGIN@8 at line 6 use base 'Exporter'; # spent 70µs making 1 call to YAML::XS::BEGIN@6 # spent 63µs making 1 call to base::import
7 |  |  |  |  |
8 | 1 | 900ns |  |  | @YAML::XS::EXPORT = qw(Load Dump);
9 | 1 | 500ns |  |  | @YAML::XS::EXPORT_OK = qw(LoadFile DumpFile);
10 | 1 | 2µs |  |  | %YAML::XS::EXPORT_TAGS = (
11 |  |  |  |  | all => [qw(Dump Load LoadFile DumpFile)],
12 |  |  |  |  | );
13 |  |  |  |  | # $YAML::XS::UseCode = 0;
14 |  |  |  |  | # $YAML::XS::DumpCode = 0;
15 |  |  |  |  | # $YAML::XS::LoadCode = 0;
16 |  |  |  |  |
17 | 1 | 200ns |  |  | $YAML::XS::QuoteNumericStrings = 1;
18 |  |  |  |  |
19 | 2 | 257µs | 2 | 548µs | # spent 509µs (191+318) within YAML::XS::BEGIN@19 which was called: # once (191µs+318µs) by PONAPI::Server::ConfigReader::BEGIN@8 at line 19 use YAML::XS::LibYAML qw(Load Dump); # spent 509µs making 1 call to YAML::XS::BEGIN@19 # spent 39µs making 1 call to Exporter::import
20 |  |  |  |  |
21 |  |  |  |  | sub DumpFile {
22 |  |  |  |  | my $OUT;
23 |  |  |  |  | my $filename = shift;
24 |  |  |  |  | if (ref $filename eq 'GLOB') {
25 |  |  |  |  | $OUT = $filename;
26 |  |  |  |  | }
27 |  |  |  |  | else {
28 |  |  |  |  | my $mode = '>';
29 |  |  |  |  | if ($filename =~ /^\s*(>{1,2})\s*(.*)$/) {
30 |  |  |  |  | ($mode, $filename) = ($1, $2);
31 |  |  |  |  | }
32 |  |  |  |  | open $OUT, $mode, $filename
33 |  |  |  |  | or die "Can't open '$filename' for output:\n$!";
34 |  |  |  |  | }
35 |  |  |  |  | local $/ = "\n"; # reset special to "sane"
36 |  |  |  |  | print $OUT YAML::XS::LibYAML::Dump(@_);
37 |  |  |  |  | }
38 |  |  |  |  |
39 |  |  |  |  | sub LoadFile {
40 |  |  |  |  | my $IN;
41 |  |  |  |  | my $filename = shift;
42 |  |  |  |  | if (ref $filename eq 'GLOB') {
43 |  |  |  |  | $IN = $filename;
44 |  |  |  |  | }
45 |  |  |  |  | else {
46 |  |  |  |  | open $IN, $filename
47 |  |  |  |  | or die "Can't open '$filename' for input:\n$!";
48 |  |  |  |  | }
49 |  |  |  |  | return YAML::XS::LibYAML::Load(do { local $/; local $_ = <$IN> });
50 |  |  |  |  | }
51 |  |  |  |  |
52 |  |  |  |  | # XXX Figure out how to lazily load this module.
53 |  |  |  |  | # So far I've tried using the C function:
54 |  |  |  |  | # load_module(PERL_LOADMOD_NOIMPORT, newSVpv("B::Deparse", 0), NULL);
55 |  |  |  |  | # But it didn't seem to work.
56 | 2 | 531µs | 1 | 31.7ms | # spent 31.7ms (25.6+6.15) within YAML::XS::BEGIN@56 which was called: # once (25.6ms+6.15ms) by PONAPI::Server::ConfigReader::BEGIN@8 at line 56 use B::Deparse; # spent 31.7ms making 1 call to YAML::XS::BEGIN@56
57 |  |  |  |  |
58 |  |  |  |  | # XXX The following code should be moved from Perl to C.
59 |  |  |  |  | $YAML::XS::coderef2text = sub {
60 |  |  |  |  | my $coderef = shift;
61 |  |  |  |  | my $deparse = B::Deparse->new();
62 |  |  |  |  | my $text;
63 |  |  |  |  | eval {
64 |  |  |  |  | local $^W = 0;
65 |  |  |  |  | $text = $deparse->coderef2text($coderef);
66 |  |  |  |  | };
67 |  |  |  |  | if ($@) {
68 |  |  |  |  | warn "YAML::XS failed to dump code ref:\n$@";
69 |  |  |  |  | return;
70 |  |  |  |  | }
71 |  |  |  |  | $text =~ s[BEGIN \{\$\{\^WARNING_BITS\} = "UUUUUUUUUUUU\\001"\}]
72 |  |  |  |  | [use warnings;]g;
73 |  |  |  |  |
74 |  |  |  |  | return $text;
75 | 1 | 2µs |  |  | };
76 |  |  |  |  |
77 |  |  |  |  | $YAML::XS::glob2hash = sub {
78 |  |  |  |  | my $hash = {};
79 |  |  |  |  | for my $type (qw(PACKAGE NAME SCALAR ARRAY HASH CODE IO)) {
80 |  |  |  |  | my $value = *{$_[0]}{$type};
81 |  |  |  |  | $value = $$value if $type eq 'SCALAR';
82 |  |  |  |  | if (defined $value) {
83 |  |  |  |  | if ($type eq 'IO') {
84 |  |  |  |  | my @stats = qw(device inode mode links uid gid rdev size
85 |  |  |  |  | atime mtime ctime blksize blocks);
86 |  |  |  |  | undef $value;
87 |  |  |  |  | $value->{stat} = {};
88 |  |  |  |  | map {$value->{stat}{shift @stats} = $_} stat(*{$_[0]});
89 |  |  |  |  | $value->{fileno} = fileno(*{$_[0]});
90 |  |  |  |  | {
91 |  |  |  |  | local $^W;
92 |  |  |  |  | $value->{tell} = tell(*{$_[0]});
93 |  |  |  |  | }
94 |  |  |  |  | }
95 |  |  |  |  | $hash->{$type} = $value;
96 |  |  |  |  | }
97 |  |  |  |  | }
98 |  |  |  |  | return $hash;
99 | 1 | 1µs |  |  | };
100 |  |  |  |  |
101 |  |  |  |  | # spent 74µs (28+46) within YAML::XS::BEGIN@101 which was called: # once (28µs+46µs) by PONAPI::Server::ConfigReader::BEGIN@8 at line 118 use constant _QR_MAP => {
102 |  |  |  |  | '' => sub { qr{$_[0]} },
103 |  |  |  |  | x => sub { qr{$_[0]}x },
104 |  |  |  |  | i => sub { qr{$_[0]}i },
105 |  |  |  |  | s => sub { qr{$_[0]}s },
106 |  |  |  |  | m => sub { qr{$_[0]}m },
107 |  |  |  |  | ix => sub { qr{$_[0]}ix },
108 |  |  |  |  | sx => sub { qr{$_[0]}sx },
109 |  |  |  |  | mx => sub { qr{$_[0]}mx },
110 |  |  |  |  | si => sub { qr{$_[0]}si },
111 |  |  |  |  | mi => sub { qr{$_[0]}mi },
112 |  |  |  |  | ms => sub { qr{$_[0]}sm },
113 |  |  |  |  | six => sub { qr{$_[0]}six },
114 |  |  |  |  | mix => sub { qr{$_[0]}mix },
115 |  |  |  |  | msx => sub { qr{$_[0]}msx },
116 |  |  |  |  | msi => sub { qr{$_[0]}msi },
117 |  |  |  |  | msix => sub { qr{$_[0]}msix },
118 | 2 | 116µs | 2 | 120µs | }; # spent 74µs making 1 call to YAML::XS::BEGIN@101 # spent 46µs making 1 call to constant::import
119 |  |  |  |  |
120 |  |  |  |  | sub __qr_loader {
121 |  |  |  |  | if ($_[0] =~ /\A \(\? ([ixsm]*) (?:- (?:[ixsm]*))? : (.*) \) \z/x) {
122 |  |  |  |  | my $sub = _QR_MAP->{$1} || _QR_MAP->{''};
123 |  |  |  |  | &$sub($2);
124 |  |  |  |  | }
125 |  |  |  |  | else {
126 |  |  |  |  | qr/$_[0]/;
127 |  |  |  |  | }
128 |  |  |  |  | }
129 |  |  |  |  |
130 | 1 | 4µs |  |  | 1;