← Index
NYTProf Performance Profile   « line view »
For rbm/rbm
  Run on Wed Feb 12 20:36:06 2020
Reported on Wed Feb 12 21:42:25 2020

Filename/usr/share/perl/5.28/Symbol.pm
StatementsExecuted 109642 statements in 384ms
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
913621142ms178msSymbol::::qualify_to_refSymbol::qualify_to_ref
1370422100ms121msSymbol::::qualifySymbol::qualify
91362174.8ms74.8msSymbol::::gensymSymbol::gensym
45681116.5ms16.5msSymbol::::CORE:matchSymbol::CORE:match (opcode)
4568114.00ms4.00msSymbol::::CORE:substSymbol::CORE:subst (opcode)
11111µs11µsSymbol::::BEGIN@3Symbol::BEGIN@3
0000s0sSymbol::::delete_packageSymbol::delete_package
0000s0sSymbol::::geniosymSymbol::geniosym
0000s0sSymbol::::ungensymSymbol::ungensym
Call graph for these subroutines as a Graphviz dot language file.
Line State
ments
Time
on line
Calls Time
in subs
Code
1package Symbol;
2
31520µs111µs
# spent 11µs within Symbol::BEGIN@3 which was called: # once (11µs+0s) by IO::Handle::BEGIN@6 at line 3
BEGIN { require 5.005; }
# spent 11µs making 1 call to Symbol::BEGIN@3
4
51600nsrequire Exporter;
616µs@ISA = qw(Exporter);
71700ns@EXPORT = qw(gensym ungensym qualify qualify_to_ref);
81300ns@EXPORT_OK = qw(delete_package geniosym);
9
101200ns$VERSION = '1.08';
11
121200nsmy $genpkg = "Symbol::";
131200nsmy $genseq = 0;
14
1517µsmy %global = map {$_ => 1} qw(ARGV ARGVOUT ENV INC SIG STDERR STDIN STDOUT);
16
17#
18# Note that we never _copy_ the glob; we just make a ref to it.
19# If we did copy it, then SVf_FAKE would be set on the copy, and
20# glob-specific behaviors (e.g. C<*$ref = \&func>) wouldn't work.
21#
22
# spent 74.8ms within Symbol::gensym which was called 9136 times, avg 8µs/call: # 4568 times (50.2ms+0s) by IO::CaptureOutput::_proxy::new at line 156 of IO/CaptureOutput.pm, avg 11µs/call # 4568 times (24.6ms+0s) by IO::CaptureOutput::_proxy::new at line 164 of IO/CaptureOutput.pm, avg 5µs/call
sub gensym () {
2391366.05ms my $name = "GEN" . $genseq++;
24913650.7ms my $ref = \*{$genpkg . $name};
2591367.07ms delete $$genpkg{$name};
26913629.2ms $ref;
27}
28
29sub geniosym () {
30 my $sym = gensym();
31 # force the IO slot to be filled
32 select(select $sym);
33 *$sym{IO};
34}
35
36sub ungensym ($) {}
37
38
# spent 121ms (100+20.5) within Symbol::qualify which was called 13704 times, avg 9µs/call: # 9136 times (36.3ms+0s) by Symbol::qualify_to_ref at line 57, avg 4µs/call # 4568 times (63.8ms+20.5ms) by IO::CaptureOutput::_proxy::new at line 148 of IO/CaptureOutput.pm, avg 18µs/call
sub qualify ($;$) {
39137048.64ms my ($name) = @_;
401370421.5ms if (!ref($name) && index($name, '::') == -1 && index($name, "'") == -1) {
414568609µs my $pkg;
42 # Global names: special character, "^xyz", or other.
43456836.9ms456816.5ms if ($name =~ /^(([^a-z])|(\^[a-z_]+))\z/i || $global{$name}) {
# spent 16.5ms making 4568 calls to Symbol::CORE:match, avg 4µs/call
44 # RGS 2001-11-05 : translate leading ^X to control-char
45456817.2ms45684.00ms $name =~ s/^\^([a-z_])/'qq(\c'.$1.')'/eei;
# spent 4.00ms making 4568 calls to Symbol::CORE:subst, avg 877ns/call
4645682.53ms $pkg = "main";
47 }
48 else {
49 $pkg = (@_ > 1) ? $_[1] : caller;
50 }
5145683.26ms $name = $pkg . "::" . $name;
52 }
531370462.3ms $name;
54}
55
56
# spent 178ms (142+36.3) within Symbol::qualify_to_ref which was called 9136 times, avg 20µs/call: # 4568 times (93.5ms+29.5ms) by IO::CaptureOutput::_proxy::DESTROY at line 193 of IO/CaptureOutput.pm, avg 27µs/call # 4568 times (48.5ms+6.78ms) by IO::CaptureOutput::_proxy::new at line 149 of IO/CaptureOutput.pm, avg 12µs/call
sub qualify_to_ref ($;$) {
579136137ms913636.3ms return \*{ qualify $_[0], @_ > 1 ? $_[1] : caller };
# spent 36.3ms making 9136 calls to Symbol::qualify, avg 4µs/call
58}
59
60#
61# of Safe.pm lineage
62#
63sub delete_package ($) {
64 my $pkg = shift;
65
66 # expand to full symbol table name if needed
67
68 unless ($pkg =~ /^main::.*::$/) {
69 $pkg = "main$pkg" if $pkg =~ /^::/;
70 $pkg = "main::$pkg" unless $pkg =~ /^main::/;
71 $pkg .= '::' unless $pkg =~ /::$/;
72 }
73
74 my($stem, $leaf) = $pkg =~ m/(.*::)(\w+::)$/;
75 my $stem_symtab = *{$stem}{HASH};
76 return unless defined $stem_symtab and exists $stem_symtab->{$leaf};
77
78 # free all the symbols in the package
79
80 my $leaf_symtab = *{$stem_symtab->{$leaf}}{HASH};
81 foreach my $name (keys %$leaf_symtab) {
82 undef *{$pkg . $name};
83 }
84
85 # delete the symbol table
86
87 %$leaf_symtab = ();
88 delete $stem_symtab->{$leaf};
89}
90
9117µs1;
 
# spent 16.5ms within Symbol::CORE:match which was called 4568 times, avg 4µs/call: # 4568 times (16.5ms+0s) by Symbol::qualify at line 43, avg 4µs/call
sub Symbol::CORE:match; # opcode
# spent 4.00ms within Symbol::CORE:subst which was called 4568 times, avg 877ns/call: # 4568 times (4.00ms+0s) by Symbol::qualify at line 45, avg 877ns/call
sub Symbol::CORE:subst; # opcode