← Index
NYTProf Performance Profile   « line view »
For rbm/rbm
  Run on Wed Feb 12 03:38:15 2020
Reported on Wed Feb 12 04:56:35 2020

Filename/usr/lib/x86_64-linux-gnu/perl5/5.28/YAML/XS.pm
StatementsExecuted 1028 statements in 48.8ms
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
1441132.6ms32.6msYAML::XS::::CORE:readlineYAML::XS::CORE:readline (opcode)
144112.62ms46.1msYAML::XS::::LoadFileYAML::XS::LoadFile
1111.41ms1.51msYAML::XS::::BEGIN@6YAML::XS::BEGIN@6
144111.04ms1.04msYAML::XS::::CORE:openYAML::XS::CORE:open (opcode)
111981µs1.71msYAML::XS::::BEGIN@20YAML::XS::BEGIN@20
111725µs1.03msYAML::XS::::BEGIN@21YAML::XS::BEGIN@21
11127µs78µsYAML::XS::::BEGIN@99YAML::XS::BEGIN@99
11124µs28µsRBM::::BEGIN@1.2 RBM::BEGIN@1.2
11110µs32µsRBM::::BEGIN@1.3 RBM::BEGIN@1.3
0000s0sYAML::XS::::DumpFileYAML::XS::DumpFile
0000s0sYAML::XS::::__ANON__[:100]YAML::XS::__ANON__[:100]
0000s0sYAML::XS::::__ANON__[:101]YAML::XS::__ANON__[:101]
0000s0sYAML::XS::::__ANON__[:102]YAML::XS::__ANON__[:102]
0000s0sYAML::XS::::__ANON__[:103]YAML::XS::__ANON__[:103]
0000s0sYAML::XS::::__ANON__[:104]YAML::XS::__ANON__[:104]
0000s0sYAML::XS::::__ANON__[:105]YAML::XS::__ANON__[:105]
0000s0sYAML::XS::::__ANON__[:106]YAML::XS::__ANON__[:106]
0000s0sYAML::XS::::__ANON__[:107]YAML::XS::__ANON__[:107]
0000s0sYAML::XS::::__ANON__[:108]YAML::XS::__ANON__[:108]
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__[:135]YAML::XS::__ANON__[:135]
0000s0sYAML::XS::::__ANON__[:73]YAML::XS::__ANON__[:73]
0000s0sYAML::XS::::__ANON__[:97]YAML::XS::__ANON__[:97]
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
1467µs485µs
# spent 28µs (24+4) within RBM::BEGIN@1.2 which was called: # once (24µs+4µs) by RBM::BEGIN@8 at line 1 # spent 32µs (10+22) within RBM::BEGIN@1.3 which was called: # once (10µs+22µs) by RBM::BEGIN@8 at line 1
use strict; use warnings;
# spent 32µs making 1 call to RBM::BEGIN@1.3 # spent 28µs making 1 call to RBM::BEGIN@1.2 # spent 22µs making 1 call to warnings::import # spent 4µs making 1 call to strict::import
2
3package YAML::XS;
41500nsour $VERSION = '0.76';
5
62168µs21.57ms
# spent 1.51ms (1.41+99µs) within YAML::XS::BEGIN@6 which was called: # once (1.41ms+99µs) by RBM::BEGIN@8 at line 6
use base 'Exporter';
# spent 1.51ms making 1 call to YAML::XS::BEGIN@6 # spent 62µs making 1 call to base::import
7
81900ns@YAML::XS::EXPORT = qw(Load Dump);
91500ns@YAML::XS::EXPORT_OK = qw(LoadFile DumpFile);
1011µs%YAML::XS::EXPORT_TAGS = (
11 all => [qw(Dump Load LoadFile DumpFile)],
12);
13our ($UseCode, $DumpCode, $LoadCode, $Boolean, $LoadBlessed, $Indent);
14# $YAML::XS::UseCode = 0;
15# $YAML::XS::DumpCode = 0;
16# $YAML::XS::LoadCode = 0;
17
181200ns$YAML::XS::QuoteNumericStrings = 1;
19
202860µs21.75ms
# spent 1.71ms (981µs+727µs) within YAML::XS::BEGIN@20 which was called: # once (981µs+727µs) by RBM::BEGIN@8 at line 20
use YAML::XS::LibYAML qw(Load Dump);
# spent 1.71ms making 1 call to YAML::XS::BEGIN@20 # spent 46µs making 1 call to Exporter::import
2121.14ms21.07ms
# spent 1.03ms (725µs+305µs) within YAML::XS::BEGIN@21 which was called: # once (725µs+305µs) by RBM::BEGIN@8 at line 21
use Scalar::Util qw/ openhandle /;
# spent 1.03ms making 1 call to YAML::XS::BEGIN@21 # spent 45µs making 1 call to Exporter::import
22
23sub DumpFile {
24 my $OUT;
25 my $filename = shift;
26 if (openhandle $filename) {
27 $OUT = $filename;
28 }
29 else {
30 my $mode = '>';
31 if ($filename =~ /^\s*(>{1,2})\s*(.*)$/) {
32 ($mode, $filename) = ($1, $2);
33 }
34 open $OUT, $mode, $filename
35 or die "Can't open '$filename' for output:\n$!";
36 }
37 local $/ = "\n"; # reset special to "sane"
38 print $OUT YAML::XS::LibYAML::Dump(@_);
39}
40
41
# spent 46.1ms (2.62+43.5) within YAML::XS::LoadFile which was called 144 times, avg 320µs/call: # 144 times (2.62ms+43.5ms) by RBM::load_config_file at line 32 of /root/tor-browser-build/rbm/lib/RBM.pm, avg 320µs/call
sub LoadFile {
4214417µs my $IN;
4314434µs my $filename = shift;
44144293µs14467µs if (openhandle $filename) {
# spent 67µs making 144 calls to Scalar::Util::openhandle, avg 465ns/call
45 $IN = $filename;
46 }
47 else {
481441.44ms1441.04ms open $IN, $filename
# spent 1.04ms making 144 calls to YAML::XS::CORE:open, avg 7µs/call
49 or die "Can't open '$filename' for input:\n$!";
50 }
5143244.5ms28842.4ms return YAML::XS::LibYAML::Load(do { local $/; local $_ = <$IN> });
# spent 32.6ms making 144 calls to YAML::XS::CORE:readline, avg 227µs/call # spent 9.74ms making 144 calls to YAML::XS::LibYAML::Load, avg 68µs/call
52}
53
54
55# XXX The following code should be moved from Perl to C.
56$YAML::XS::coderef2text = sub {
57 my $coderef = shift;
58 require B::Deparse;
59 my $deparse = B::Deparse->new();
60 my $text;
61 eval {
62 local $^W = 0;
63 $text = $deparse->coderef2text($coderef);
64 };
65 if ($@) {
66 warn "YAML::XS failed to dump code ref:\n$@";
67 return;
68 }
69 $text =~ s[BEGIN \{\$\{\^WARNING_BITS\} = "UUUUUUUUUUUU\\001"\}]
70 [use warnings;]g;
71
72 return $text;
7312µs};
74
75$YAML::XS::glob2hash = sub {
76 my $hash = {};
77 for my $type (qw(PACKAGE NAME SCALAR ARRAY HASH CODE IO)) {
78 my $value = *{$_[0]}{$type};
79 $value = $$value if $type eq 'SCALAR';
80 if (defined $value) {
81 if ($type eq 'IO') {
82 my @stats = qw(device inode mode links uid gid rdev size
83 atime mtime ctime blksize blocks);
84 undef $value;
85 $value->{stat} = {};
86 map {$value->{stat}{shift @stats} = $_} stat(*{$_[0]});
87 $value->{fileno} = fileno(*{$_[0]});
88 {
89 local $^W;
90 $value->{tell} = tell(*{$_[0]});
91 }
92 }
93 $hash->{$type} = $value;
94 }
95 }
96 return $hash;
9712µs};
98
99
# spent 78µs (27+51) within YAML::XS::BEGIN@99 which was called: # once (27µs+51µs) by RBM::BEGIN@8 at line 116
use constant _QR_MAP => {
100 '' => sub { qr{$_[0]} },
101 x => sub { qr{$_[0]}x },
102 i => sub { qr{$_[0]}i },
103 s => sub { qr{$_[0]}s },
104 m => sub { qr{$_[0]}m },
105 ix => sub { qr{$_[0]}ix },
106 sx => sub { qr{$_[0]}sx },
107 mx => sub { qr{$_[0]}mx },
108 si => sub { qr{$_[0]}si },
109 mi => sub { qr{$_[0]}mi },
110 ms => sub { qr{$_[0]}sm },
111 six => sub { qr{$_[0]}six },
112 mix => sub { qr{$_[0]}mix },
113 msx => sub { qr{$_[0]}msx },
114 msi => sub { qr{$_[0]}msi },
115 msix => sub { qr{$_[0]}msix },
1162354µs2128µs};
# spent 78µs making 1 call to YAML::XS::BEGIN@99 # spent 51µs making 1 call to constant::import
117
118sub __qr_loader {
119 if ($_[0] =~ /\A \(\? ([\^uixsm]*) (?:- (?:[ixsm]*))? : (.*) \) \z/x) {
120 my ($flags, $re) = ($1, $2);
121 $flags =~ s/^\^//;
122 $flags =~ tr/u//d;
123 my $sub = _QR_MAP->{$flags} || _QR_MAP->{''};
124 my $qr = &$sub($re);
125 return $qr;
126 }
127 return qr/$_[0]/;
128}
129
130sub __code_loader {
131 my ($string) = @_;
132 my $sub = eval "sub $string";
133 if ($@) {
134 warn "YAML::XS failed to load sub: $@";
135 return sub {};
136 }
137 return $sub;
138}
139
14017µs1;
 
# spent 1.04ms within YAML::XS::CORE:open which was called 144 times, avg 7µs/call: # 144 times (1.04ms+0s) by YAML::XS::LoadFile at line 48, avg 7µs/call
sub YAML::XS::CORE:open; # opcode
# spent 32.6ms within YAML::XS::CORE:readline which was called 144 times, avg 227µs/call: # 144 times (32.6ms+0s) by YAML::XS::LoadFile at line 51, avg 227µs/call
sub YAML::XS::CORE:readline; # opcode