← Index
NYTProf Performance Profile   « line view »
For split.pl
  Run on Thu Apr 20 02:05:47 2023
Reported on Thu Apr 20 18:31:09 2023

Filename/home/hejohns/perl5/lib/perl5/x86_64-linux-gnu-thread-multi/YAML/XS.pm
StatementsExecuted 21 statements in 941µs
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
111863µs914µsYAML::XS::::BEGIN@6YAML::XS::BEGIN@6
111148µs360µsYAML::XS::::BEGIN@29YAML::XS::BEGIN@29
11123µs58µsYAML::XS::::BEGIN@108YAML::XS::BEGIN@108
1118µs10µsmain::::BEGIN@1 main::BEGIN@1
1115µs14µsYAML::XS::::BEGIN@30YAML::XS::BEGIN@30
1114µs23µsmain::::BEGIN@1.3 main::BEGIN@1.3
0000s0sYAML::XS::::DumpFileYAML::XS::DumpFile
0000s0sYAML::XS::::LoadFileYAML::XS::LoadFile
0000s0sYAML::XS::::__ANON__[:106]YAML::XS::__ANON__[:106]
0000s0sYAML::XS::::__ANON__[:109]YAML::XS::__ANON__[:109]
0000s0sYAML::XS::::__ANON__[:110]YAML::XS::__ANON__[:110]
0000s0sYAML::XS::::__ANON__[:111]YAML::XS::__ANON__[:111]
0000s0sYAML::XS::::__ANON__[:112]YAML::XS::__ANON__[:112]
0000s0sYAML::XS::::__ANON__[:113]YAML::XS::__ANON__[:113]
0000s0sYAML::XS::::__ANON__[:114]YAML::XS::__ANON__[:114]
0000s0sYAML::XS::::__ANON__[:115]YAML::XS::__ANON__[:115]
0000s0sYAML::XS::::__ANON__[:116]YAML::XS::__ANON__[:116]
0000s0sYAML::XS::::__ANON__[:117]YAML::XS::__ANON__[:117]
0000s0sYAML::XS::::__ANON__[:118]YAML::XS::__ANON__[:118]
0000s0sYAML::XS::::__ANON__[:119]YAML::XS::__ANON__[:119]
0000s0sYAML::XS::::__ANON__[:120]YAML::XS::__ANON__[:120]
0000s0sYAML::XS::::__ANON__[:121]YAML::XS::__ANON__[:121]
0000s0sYAML::XS::::__ANON__[:122]YAML::XS::__ANON__[:122]
0000s0sYAML::XS::::__ANON__[:123]YAML::XS::__ANON__[:123]
0000s0sYAML::XS::::__ANON__[:124]YAML::XS::__ANON__[:124]
0000s0sYAML::XS::::__ANON__[:144]YAML::XS::__ANON__[:144]
0000s0sYAML::XS::::__ANON__[:82]YAML::XS::__ANON__[:82]
0000s0sYAML::XS::::__code_loaderYAML::XS::__code_loader
0000s0sYAML::XS::::__qr_loaderYAML::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
1444µs452µs
# spent 23µs (4+18) within main::BEGIN@1.3 which was called: # once (4µs+18µs) by main::BEGIN@22 at line 1 # spent 10µs (8+2) within main::BEGIN@1 which was called: # once (8µs+2µs) by main::BEGIN@22 at line 1
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
3package YAML::XS;
41300nsour $VERSION = '0.85';
5
62124µs2948µ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
use base 'Exporter';
# spent 914µs making 1 call to YAML::XS::BEGIN@6 # spent 35µs making 1 call to base::import
7
81700ns@YAML::XS::EXPORT = qw(Load Dump);
91400ns@YAML::XS::EXPORT_OK = qw(LoadFile DumpFile);
1011µs%YAML::XS::EXPORT_TAGS = (
11 all => [qw(Dump Load LoadFile DumpFile)],
12);
13our (
14 $Boolean,
15 $DumpCode,
16 $ForbidDuplicateKeys,
17 $Indent,
18 $LoadBlessed,
19 $LoadCode,
20 $UseCode,
21);
221100ns$ForbidDuplicateKeys = 0;
23# $YAML::XS::UseCode = 0;
24# $YAML::XS::DumpCode = 0;
25# $YAML::XS::LoadCode = 0;
26
271100ns$YAML::XS::QuoteNumericStrings = 1;
28
29277µs2382µ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
use YAML::XS::LibYAML qw(Load Dump);
# spent 360µs making 1 call to YAML::XS::BEGIN@29 # spent 22µs making 1 call to Exporter::import
302510µs222µ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
use Scalar::Util qw/ openhandle /;
# spent 14µs making 1 call to YAML::XS::BEGIN@30 # spent 8µs making 1 call to Exporter::import
31
32sub 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
50sub 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;
8212µ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;
10612µ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
use constant _QR_MAP => {
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 },
1252175µs293µs};
# spent 58µs making 1 call to YAML::XS::BEGIN@108 # spent 35µs making 1 call to constant::import
126
127sub __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
139sub __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
14915µs1;