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