← Index
NYTProf Performance Profile   « line view »
For opt.pl
  Run on Tue May 12 15:32:29 2015
Reported on Tue May 12 15:32:30 2015

Filename/home/lbr/.plenv/versions/5.20.2/lib/perl5/5.20.2/vars.pm
StatementsExecuted 32 statements in 495µs
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
111125µs188µsvars::::BEGIN@7vars::BEGIN@7
22249µs60µsvars::::importvars::import
11116µs16µsvars::::BEGIN@3vars::BEGIN@3
123111µs11µsvars::::CORE:matchvars::CORE:match (opcode)
1118µs21µ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
3244µs116µs
# spent 16µs within vars::BEGIN@3 which was called: # once (16µs+0s) by Config::BEGIN@11 at line 3
use 5.006;
# spent 16µs making 1 call to vars::BEGIN@3
4
51400nsour $VERSION = '1.03';
6
72156µs2251µs
# spent 188µs (125+63) within vars::BEGIN@7 which was called: # once (125µs+63µs) by Config::BEGIN@11 at line 7
use warnings::register;
# spent 188µs making 1 call to vars::BEGIN@7 # spent 63µs making 1 call to warnings::register::import
82231µs234µs
# spent 21µs (8+13) within vars::BEGIN@8 which was called: # once (8µs+13µs) by Config::BEGIN@11 at line 8
use strict qw(vars subs);
# spent 21µs making 1 call to vars::BEGIN@8 # spent 13µs making 1 call to strict::import
9
10
# spent 60µs (49+11) within vars::import which was called 2 times, avg 30µs/call: # once (25µs+6µs) by constant::BEGIN@6 at line 6 of constant.pm # once (24µs+5µs) by Config::BEGIN@11 at line 11 of Config.pm
sub import {
1121µs my $callpack = caller;
1222µs my (undef, @imports) = @_;
132500ns my ($sym, $ch);
1427µs foreach (@imports) {
15423µs47µs if (($ch, $sym) = /^([\$\@\%\*\&])(.+)/) {
# spent 7µs making 4 calls to vars::CORE:match, avg 2µs/call
1647µs42µs if ($sym =~ /\W/) {
# spent 2µs making 4 calls to vars::CORE:match, avg 575ns/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 }
2848µs41µs $sym = "${callpack}::$sym" unless $sym =~ /::/;
# spent 1µs making 4 calls to vars::CORE:match, avg 275ns/call
29 *$sym =
30 ( $ch eq "\$" ? \$$sym
31 : $ch eq "\@" ? \@$sym
32 : $ch eq "\%" ? \%$sym
33 : $ch eq "\*" ? \*$sym
34 : $ch eq "\&" ? \&$sym
35411µ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 11µs within vars::CORE:match which was called 12 times, avg 892ns/call: # 4 times (7µs+0s) by vars::import at line 15, avg 2µs/call # 4 times (2µs+0s) by vars::import at line 16, avg 575ns/call # 4 times (1µs+0s) by vars::import at line 28, avg 275ns/call
sub vars::CORE:match; # opcode