← Index
NYTProf Performance Profile   « line view »
For opt.pl
  Run on Fri May 8 15:08:12 2015
Reported on Fri May 8 15:08:16 2015

Filename/home/lbr/.plenv/versions/5.20.2/lib/perl5/5.20.2/vars.pm
StatementsExecuted 20 statements in 316µs
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
11124µs29µsvars::::importvars::import
11110µs10µsvars::::BEGIN@3vars::BEGIN@3
6315µs5µsvars::::CORE:matchvars::CORE:match (opcode)
1115µs59µsvars::::BEGIN@7vars::BEGIN@7
1114µs13µ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
3240µs110µs
# spent 10µs within vars::BEGIN@3 which was called: # once (10µs+0s) by constant::BEGIN@6 at line 3
use 5.006;
# spent 10µs making 1 call to vars::BEGIN@3
4
51400nsour $VERSION = '1.03';
6
7218µs2113µs
# spent 59µs (5+54) within vars::BEGIN@7 which was called: # once (5µs+54µs) by constant::BEGIN@6 at line 7
use warnings::register;
# spent 59µs making 1 call to vars::BEGIN@7 # spent 54µs making 1 call to warnings::register::import
82224µs221µs
# spent 13µs (4+8) within vars::BEGIN@8 which was called: # once (4µs+8µs) by constant::BEGIN@6 at line 8
use strict qw(vars subs);
# spent 13µs making 1 call to vars::BEGIN@8 # spent 8µs making 1 call to strict::import
9
10
# spent 29µs (24+5) within vars::import which was called: # once (24µs+5µs) by constant::BEGIN@6 at line 6 of constant.pm
sub import {
111600ns my $callpack = caller;
1211µs my (undef, @imports) = @_;
131200ns my ($sym, $ch);
1413µs foreach (@imports) {
15212µs24µs if (($ch, $sym) = /^([\$\@\%\*\&])(.+)/) {
# spent 4µs making 2 calls to vars::CORE:match, avg 2µs/call
1624µs21µs if ($sym =~ /\W/) {
# spent 1µs making 2 calls to vars::CORE:match, avg 500ns/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 }
2824µs2500ns $sym = "${callpack}::$sym" unless $sym =~ /::/;
# spent 500ns making 2 calls to vars::CORE:match, avg 250ns/call
29 *$sym =
30 ( $ch eq "\$" ? \$$sym
31 : $ch eq "\@" ? \@$sym
32 : $ch eq "\%" ? \%$sym
33 : $ch eq "\*" ? \*$sym
34 : $ch eq "\&" ? \&$sym
3525µ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 5µs within vars::CORE:match which was called 6 times, avg 867ns/call: # 2 times (4µs+0s) by vars::import at line 15, avg 2µs/call # 2 times (1µs+0s) by vars::import at line 16, avg 500ns/call # 2 times (500ns+0s) by vars::import at line 28, avg 250ns/call
sub vars::CORE:match; # opcode