← 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/usr/lib/x86_64-linux-gnu/perl-base/Symbol.pm
StatementsExecuted 1064313 statements in 3.91s
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
266073223.59s3.59sSymbol::::gensymSymbol::gensym
1116µs7µsSymbol::::BEGIN@3Symbol::BEGIN@3
1115µs8µsSymbol::::BEGIN@78Symbol::BEGIN@78
1115µs8µsSymbol::::BEGIN@59Symbol::BEGIN@59
1114µs21µsSymbol::::BEGIN@4Symbol::BEGIN@4
1114µs8µsSymbol::::BEGIN@25Symbol::BEGIN@25
1114µs6µsSymbol::::BEGIN@88Symbol::BEGIN@88
0000s0sSymbol::::delete_packageSymbol::delete_package
0000s0sSymbol::::geniosymSymbol::geniosym
0000s0sSymbol::::qualifySymbol::qualify
0000s0sSymbol::::qualify_to_refSymbol::qualify_to_ref
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
3214µs28µs
# spent 7µs (6+900ns) within Symbol::BEGIN@3 which was called: # once (6µs+900ns) by IO::Handle::BEGIN@266 at line 3
use strict;
# spent 7µs making 1 call to Symbol::BEGIN@3 # spent 900ns making 1 call to strict::import
4272µs238µs
# spent 21µs (4+17) within Symbol::BEGIN@4 which was called: # once (4µs+17µs) by IO::Handle::BEGIN@266 at line 4
use warnings;
# spent 21µs making 1 call to Symbol::BEGIN@4 # spent 17µs making 1 call to warnings::import
5
61500nsrequire Exporter;
717µsour @ISA = qw(Exporter);
81400nsour @EXPORT = qw(gensym ungensym qualify qualify_to_ref);
91200nsour @EXPORT_OK = qw(delete_package geniosym);
10
111100nsour $VERSION = '1.09';
12
131200nsmy $genpkg = "Symbol::";
1410smy $genseq = 0;
15
1614µsmy %global = map {$_ => 1} qw(ARGV ARGVOUT ENV INC SIG STDERR STDIN STDOUT);
17
18#
19# Note that we never _copy_ the glob; we just make a ref to it.
20# If we did copy it, then SVf_FAKE would be set on the copy, and
21# glob-specific behaviors (e.g. C<*$ref = \&func>) wouldn't work.
22#
23
# spent 3.59s within Symbol::gensym which was called 266073 times, avg 13µs/call: # 266070 times (3.59s+0s) by IO::Handle::new at line 325 of IO/Handle.pm, avg 13µs/call # 3 times (8µs+0s) by main::BEGIN@30 at line 1876 of IPC/Cmd.pm, avg 3µs/call
sub gensym () {
24266073743ms my $name = "GEN" . $genseq++;
252185µs213µs
# spent 8µs (4+4) within Symbol::BEGIN@25 which was called: # once (4µs+4µs) by IO::Handle::BEGIN@266 at line 25
no strict 'refs';
# spent 8µs making 1 call to Symbol::BEGIN@25 # spent 4µs making 1 call to strict::unimport
262660732.26s my $ref = \*{$genpkg . $name};
27266073149ms delete $$genpkg{$name};
28266073761ms $ref;
29}
30
31sub geniosym () {
32 my $sym = gensym();
33 # force the IO slot to be filled
34 select(select $sym);
35 *$sym{IO};
36}
37
38sub ungensym ($) {}
39
40sub qualify ($;$) {
41 my ($name) = @_;
42 if (!ref($name) && index($name, '::') == -1 && index($name, "'") == -1) {
43 my $pkg;
44 # Global names: special character, "^xyz", or other.
45 if ($name =~ /^(([^a-z])|(\^[a-z_]+))\z/i || $global{$name}) {
46 # RGS 2001-11-05 : translate leading ^X to control-char
47 $name =~ s/^\^([a-z_])/'qq(\c'.$1.')'/eei;
48 $pkg = "main";
49 }
50 else {
51 $pkg = (@_ > 1) ? $_[1] : caller;
52 }
53 $name = $pkg . "::" . $name;
54 }
55 $name;
56}
57
58sub qualify_to_ref ($;$) {
592138µs212µs
# spent 8µs (5+4) within Symbol::BEGIN@59 which was called: # once (5µs+4µs) by IO::Handle::BEGIN@266 at line 59
no strict 'refs';
# spent 8µs making 1 call to Symbol::BEGIN@59 # spent 4µs making 1 call to strict::unimport
60 return \*{ qualify $_[0], @_ > 1 ? $_[1] : caller };
61}
62
63#
64# of Safe.pm lineage
65#
66sub delete_package ($) {
67 my $pkg = shift;
68
69 # expand to full symbol table name if needed
70
71 unless ($pkg =~ /^main::.*::$/) {
72 $pkg = "main$pkg" if $pkg =~ /^::/;
73 $pkg = "main::$pkg" unless $pkg =~ /^main::/;
74 $pkg .= '::' unless $pkg =~ /::$/;
75 }
76
77 my($stem, $leaf) = $pkg =~ m/(.*::)(\w+::)$/;
78245µs211µs
# spent 8µs (5+3) within Symbol::BEGIN@78 which was called: # once (5µs+3µs) by IO::Handle::BEGIN@266 at line 78
no strict 'refs';
# spent 8µs making 1 call to Symbol::BEGIN@78 # spent 3µs making 1 call to strict::unimport
79 my $stem_symtab = *{$stem}{HASH};
80 return unless defined $stem_symtab and exists $stem_symtab->{$leaf};
81
82 # free all the symbols in the package
83
84 my $leaf_symtab = *{$stem_symtab->{$leaf}}{HASH};
85 foreach my $name (keys %$leaf_symtab) {
86 undef *{$pkg . $name};
87 }
88252µs28µs
# spent 6µs (4+2) within Symbol::BEGIN@88 which was called: # once (4µs+2µs) by IO::Handle::BEGIN@266 at line 88
use strict 'refs';
# spent 6µs making 1 call to Symbol::BEGIN@88 # spent 2µs making 1 call to strict::import
89
90 # delete the symbol table
91
92 %$leaf_symtab = ();
93 delete $stem_symtab->{$leaf};
94}
95
9615µs1;