← Index
NYTProf Performance Profile   « line view »
For ../dm5dm6_ex3
  Run on Mon Feb 23 08:36:56 2015
Reported on Mon Feb 23 08:37:02 2015

Filename/usr/lib/perl5/5.20.1/vars.pm
StatementsExecuted 48 statements in 399µs
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
111116µs162µsvars::::BEGIN@7vars::BEGIN@7
33353µs64µsvars::::importvars::import
213112µs12µsvars::::CORE:matchvars::CORE:match (opcode)
1118µs8µsvars::::BEGIN@3vars::BEGIN@3
1114µs10µsvars::::BEGIN@8vars::BEGIN@8
Call graph for these subroutines as a Graphviz dot language file.
Line State
ments
Time
on line
Calls Time
in subs
Code
1package vars;
2
3230µs18µs
# spent 8µs within vars::BEGIN@3 which was called: # once (8µs+0s) by Config::BEGIN@11 at line 3
use 5.006;
# spent 8µs making 1 call to vars::BEGIN@3
4
51200nsour $VERSION = '1.03';
6
72127µs2208µs
# spent 162µs (116+46) within vars::BEGIN@7 which was called: # once (116µs+46µs) by Config::BEGIN@11 at line 7
use warnings::register;
# spent 162µs making 1 call to vars::BEGIN@7 # spent 46µs making 1 call to warnings::register::import
82175µs216µs
# spent 10µs (4+6) within vars::BEGIN@8 which was called: # once (4µs+6µs) by Config::BEGIN@11 at line 8
use strict qw(vars subs);
# spent 10µs making 1 call to vars::BEGIN@8 # spent 6µs making 1 call to strict::import
9
10
# spent 64µs (53+11) within vars::import which was called 3 times, avg 21µs/call: # once (20µs+4µs) by Storable::BEGIN@23 at line 23 of Storable.pm # once (18µs+3µs) by Config::BEGIN@11 at line 11 of Config.pm # once (15µs+4µs) by constant::BEGIN@6 at line 6 of constant.pm
sub import {
1132µs my $callpack = caller;
1232µs my (undef, @imports) = @_;
133600ns my ($sym, $ch);
1436µs foreach (@imports) {
15725µs78µs if (($ch, $sym) = /^([\$\@\%\*\&])(.+)/) {
# spent 8µs making 7 calls to vars::CORE:match, avg 1µs/call
1678µs72µs if ($sym =~ /\W/) {
# spent 2µs making 7 calls to vars::CORE:match, avg 257ns/call
17 # time for a more-detailed check-up
18 if ($sym =~ /^\w+[[{].*[]}]$/) {
19 require Carp;
20 Carp::croak("Can't declare individual elements of hash or array");
21 } elsif (warnings::enabled() and length($sym) == 1 and $sym !~ tr/a-zA-Z//) {
22 warnings::warn("No need to declare built-in vars");
23 } elsif (($^H &= strict::bits('vars'))) {
24 require Carp;
25 Carp::croak("'$_' is not a valid variable name under strict vars");
26 }
27 }
2878µs71µs $sym = "${callpack}::$sym" unless $sym =~ /::/;
# spent 1µs making 7 calls to vars::CORE:match, avg 171ns/call
29 *$sym =
30 ( $ch eq "\$" ? \$$sym
31 : $ch eq "\@" ? \@$sym
32 : $ch eq "\%" ? \%$sym
33 : $ch eq "\*" ? \*$sym
34 : $ch eq "\&" ? \&$sym
35713µs : do {
36 require Carp;
37 Carp::croak("'$_' is not a valid variable name");
38 });
39 } else {
40 require Carp;
41 Carp::croak("'$_' is not a valid variable name");
42 }
43 }
44};
45
4612µs1;
47__END__
 
# spent 12µs within vars::CORE:match which was called 21 times, avg 548ns/call: # 7 times (8µs+0s) by vars::import at line 15, avg 1µs/call # 7 times (2µs+0s) by vars::import at line 16, avg 257ns/call # 7 times (1µs+0s) by vars::import at line 28, avg 171ns/call
sub vars::CORE:match; # opcode