| Filename | /home/hejohns/perl5/lib/perl5/x86_64-linux-gnu-thread-multi/YAML/XS.pm |
| Statements | Executed 21 statements in 941µs |
| Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
|---|---|---|---|---|---|
| 1 | 1 | 1 | 863µs | 914µs | YAML::XS::BEGIN@6 |
| 1 | 1 | 1 | 148µs | 360µs | YAML::XS::BEGIN@29 |
| 1 | 1 | 1 | 23µs | 58µs | YAML::XS::BEGIN@108 |
| 1 | 1 | 1 | 8µs | 10µs | main::BEGIN@1 |
| 1 | 1 | 1 | 5µs | 14µs | YAML::XS::BEGIN@30 |
| 1 | 1 | 1 | 4µs | 23µs | main::BEGIN@1.3 |
| 0 | 0 | 0 | 0s | 0s | YAML::XS::DumpFile |
| 0 | 0 | 0 | 0s | 0s | YAML::XS::LoadFile |
| 0 | 0 | 0 | 0s | 0s | YAML::XS::__ANON__[:106] |
| 0 | 0 | 0 | 0s | 0s | YAML::XS::__ANON__[:109] |
| 0 | 0 | 0 | 0s | 0s | YAML::XS::__ANON__[:110] |
| 0 | 0 | 0 | 0s | 0s | YAML::XS::__ANON__[:111] |
| 0 | 0 | 0 | 0s | 0s | YAML::XS::__ANON__[:112] |
| 0 | 0 | 0 | 0s | 0s | YAML::XS::__ANON__[:113] |
| 0 | 0 | 0 | 0s | 0s | YAML::XS::__ANON__[:114] |
| 0 | 0 | 0 | 0s | 0s | YAML::XS::__ANON__[:115] |
| 0 | 0 | 0 | 0s | 0s | YAML::XS::__ANON__[:116] |
| 0 | 0 | 0 | 0s | 0s | YAML::XS::__ANON__[:117] |
| 0 | 0 | 0 | 0s | 0s | YAML::XS::__ANON__[:118] |
| 0 | 0 | 0 | 0s | 0s | YAML::XS::__ANON__[:119] |
| 0 | 0 | 0 | 0s | 0s | YAML::XS::__ANON__[:120] |
| 0 | 0 | 0 | 0s | 0s | YAML::XS::__ANON__[:121] |
| 0 | 0 | 0 | 0s | 0s | YAML::XS::__ANON__[:122] |
| 0 | 0 | 0 | 0s | 0s | YAML::XS::__ANON__[:123] |
| 0 | 0 | 0 | 0s | 0s | YAML::XS::__ANON__[:124] |
| 0 | 0 | 0 | 0s | 0s | YAML::XS::__ANON__[:144] |
| 0 | 0 | 0 | 0s | 0s | YAML::XS::__ANON__[:82] |
| 0 | 0 | 0 | 0s | 0s | YAML::XS::__code_loader |
| 0 | 0 | 0 | 0s | 0s | YAML::XS::__qr_loader |
| Line | State ments |
Time on line |
Calls | Time in subs |
Code |
|---|---|---|---|---|---|
| 1 | 4 | 44µs | 4 | 52µs | use strict; use warnings; # spent 23µs making 1 call to main::BEGIN@1.3
# spent 18µs making 1 call to warnings::import
# spent 10µs making 1 call to main::BEGIN@1
# spent 2µs making 1 call to strict::import |
| 2 | |||||
| 3 | package YAML::XS; | ||||
| 4 | 1 | 300ns | our $VERSION = '0.85'; | ||
| 5 | |||||
| 6 | 2 | 124µs | 2 | 948µs | # spent 914µs (863+51) within YAML::XS::BEGIN@6 which was called:
# once (863µs+51µs) by main::BEGIN@22 at line 6 # spent 914µs making 1 call to YAML::XS::BEGIN@6
# spent 35µs making 1 call to base::import |
| 7 | |||||
| 8 | 1 | 700ns | @YAML::XS::EXPORT = qw(Load Dump); | ||
| 9 | 1 | 400ns | @YAML::XS::EXPORT_OK = qw(LoadFile DumpFile); | ||
| 10 | 1 | 1µs | %YAML::XS::EXPORT_TAGS = ( | ||
| 11 | all => [qw(Dump Load LoadFile DumpFile)], | ||||
| 12 | ); | ||||
| 13 | our ( | ||||
| 14 | $Boolean, | ||||
| 15 | $DumpCode, | ||||
| 16 | $ForbidDuplicateKeys, | ||||
| 17 | $Indent, | ||||
| 18 | $LoadBlessed, | ||||
| 19 | $LoadCode, | ||||
| 20 | $UseCode, | ||||
| 21 | ); | ||||
| 22 | 1 | 100ns | $ForbidDuplicateKeys = 0; | ||
| 23 | # $YAML::XS::UseCode = 0; | ||||
| 24 | # $YAML::XS::DumpCode = 0; | ||||
| 25 | # $YAML::XS::LoadCode = 0; | ||||
| 26 | |||||
| 27 | 1 | 100ns | $YAML::XS::QuoteNumericStrings = 1; | ||
| 28 | |||||
| 29 | 2 | 77µs | 2 | 382µs | # spent 360µs (148+212) within YAML::XS::BEGIN@29 which was called:
# once (148µs+212µs) by main::BEGIN@22 at line 29 # spent 360µs making 1 call to YAML::XS::BEGIN@29
# spent 22µs making 1 call to Exporter::import |
| 30 | 2 | 510µs | 2 | 22µs | # spent 14µs (5+8) within YAML::XS::BEGIN@30 which was called:
# once (5µs+8µs) by main::BEGIN@22 at line 30 # spent 14µs making 1 call to YAML::XS::BEGIN@30
# spent 8µs making 1 call to Exporter::import |
| 31 | |||||
| 32 | sub DumpFile { | ||||
| 33 | my $OUT; | ||||
| 34 | my $filename = shift; | ||||
| 35 | if (openhandle $filename) { | ||||
| 36 | $OUT = $filename; | ||||
| 37 | } | ||||
| 38 | else { | ||||
| 39 | my $mode = '>'; | ||||
| 40 | if ($filename =~ /^\s*(>{1,2})\s*(.*)$/) { | ||||
| 41 | ($mode, $filename) = ($1, $2); | ||||
| 42 | } | ||||
| 43 | open $OUT, $mode, $filename | ||||
| 44 | or die "Can't open '$filename' for output:\n$!"; | ||||
| 45 | } | ||||
| 46 | local $/ = "\n"; # reset special to "sane" | ||||
| 47 | print $OUT YAML::XS::LibYAML::Dump(@_); | ||||
| 48 | } | ||||
| 49 | |||||
| 50 | sub LoadFile { | ||||
| 51 | my $IN; | ||||
| 52 | my $filename = shift; | ||||
| 53 | if (openhandle $filename) { | ||||
| 54 | $IN = $filename; | ||||
| 55 | } | ||||
| 56 | else { | ||||
| 57 | open $IN, $filename | ||||
| 58 | or die "Can't open '$filename' for input:\n$!"; | ||||
| 59 | } | ||||
| 60 | return YAML::XS::LibYAML::Load(do { local $/; local $_ = <$IN> }); | ||||
| 61 | } | ||||
| 62 | |||||
| 63 | |||||
| 64 | # XXX The following code should be moved from Perl to C. | ||||
| 65 | $YAML::XS::coderef2text = sub { | ||||
| 66 | my $coderef = shift; | ||||
| 67 | require B::Deparse; | ||||
| 68 | my $deparse = B::Deparse->new(); | ||||
| 69 | my $text; | ||||
| 70 | eval { | ||||
| 71 | local $^W = 0; | ||||
| 72 | $text = $deparse->coderef2text($coderef); | ||||
| 73 | }; | ||||
| 74 | if ($@) { | ||||
| 75 | warn "YAML::XS failed to dump code ref:\n$@"; | ||||
| 76 | return; | ||||
| 77 | } | ||||
| 78 | $text =~ s[BEGIN \{\$\{\^WARNING_BITS\} = "UUUUUUUUUUUU\\001"\}] | ||||
| 79 | [use warnings;]g; | ||||
| 80 | |||||
| 81 | return $text; | ||||
| 82 | 1 | 2µs | }; | ||
| 83 | |||||
| 84 | $YAML::XS::glob2hash = sub { | ||||
| 85 | my $hash = {}; | ||||
| 86 | for my $type (qw(PACKAGE NAME SCALAR ARRAY HASH CODE IO)) { | ||||
| 87 | my $value = *{$_[0]}{$type}; | ||||
| 88 | $value = $$value if $type eq 'SCALAR'; | ||||
| 89 | if (defined $value) { | ||||
| 90 | if ($type eq 'IO') { | ||||
| 91 | my @stats = qw(device inode mode links uid gid rdev size | ||||
| 92 | atime mtime ctime blksize blocks); | ||||
| 93 | undef $value; | ||||
| 94 | $value->{stat} = {}; | ||||
| 95 | map {$value->{stat}{shift @stats} = $_} stat(*{$_[0]}); | ||||
| 96 | $value->{fileno} = fileno(*{$_[0]}); | ||||
| 97 | { | ||||
| 98 | local $^W; | ||||
| 99 | $value->{tell} = tell(*{$_[0]}); | ||||
| 100 | } | ||||
| 101 | } | ||||
| 102 | $hash->{$type} = $value; | ||||
| 103 | } | ||||
| 104 | } | ||||
| 105 | return $hash; | ||||
| 106 | 1 | 2µs | }; | ||
| 107 | |||||
| 108 | # spent 58µs (23+35) within YAML::XS::BEGIN@108 which was called:
# once (23µs+35µs) by main::BEGIN@22 at line 125 | ||||
| 109 | '' => sub { qr{$_[0]} }, | ||||
| 110 | x => sub { qr{$_[0]}x }, | ||||
| 111 | i => sub { qr{$_[0]}i }, | ||||
| 112 | s => sub { qr{$_[0]}s }, | ||||
| 113 | m => sub { qr{$_[0]}m }, | ||||
| 114 | ix => sub { qr{$_[0]}ix }, | ||||
| 115 | sx => sub { qr{$_[0]}sx }, | ||||
| 116 | mx => sub { qr{$_[0]}mx }, | ||||
| 117 | si => sub { qr{$_[0]}si }, | ||||
| 118 | mi => sub { qr{$_[0]}mi }, | ||||
| 119 | ms => sub { qr{$_[0]}sm }, | ||||
| 120 | six => sub { qr{$_[0]}six }, | ||||
| 121 | mix => sub { qr{$_[0]}mix }, | ||||
| 122 | msx => sub { qr{$_[0]}msx }, | ||||
| 123 | msi => sub { qr{$_[0]}msi }, | ||||
| 124 | msix => sub { qr{$_[0]}msix }, | ||||
| 125 | 2 | 175µs | 2 | 93µs | }; # spent 58µs making 1 call to YAML::XS::BEGIN@108
# spent 35µs making 1 call to constant::import |
| 126 | |||||
| 127 | sub __qr_loader { | ||||
| 128 | if ($_[0] =~ /\A \(\? ([\^uixsm]*) (?:- (?:[ixsm]*))? : (.*) \) \z/x) { | ||||
| 129 | my ($flags, $re) = ($1, $2); | ||||
| 130 | $flags =~ s/^\^//; | ||||
| 131 | $flags =~ tr/u//d; | ||||
| 132 | my $sub = _QR_MAP->{$flags} || _QR_MAP->{''}; | ||||
| 133 | my $qr = &$sub($re); | ||||
| 134 | return $qr; | ||||
| 135 | } | ||||
| 136 | return qr/$_[0]/; | ||||
| 137 | } | ||||
| 138 | |||||
| 139 | sub __code_loader { | ||||
| 140 | my ($string) = @_; | ||||
| 141 | my $sub = eval "sub $string"; | ||||
| 142 | if ($@) { | ||||
| 143 | warn "YAML::XS failed to load sub: $@"; | ||||
| 144 | return sub {}; | ||||
| 145 | } | ||||
| 146 | return $sub; | ||||
| 147 | } | ||||
| 148 | |||||
| 149 | 1 | 5µs | 1; |