← Index
NYTProf Performance Profile   « line view »
For examples/benchmark4.pl
  Run on Thu Aug 28 19:01:43 2014
Reported on Thu Aug 28 19:02:42 2014

Filename/usr/share/perl/5.18/vars.pm
StatementsExecuted 184 statements in 982µs
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
998335µs411µsvars::::importvars::import
111199µs264µsvars::::BEGIN@7vars::BEGIN@7
1053176µs76µsvars::::CORE:matchvars::CORE:match (opcode)
11115µs15µsvars::::BEGIN@3vars::BEGIN@3
1116µs16µ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
3251µs115µs
# spent 15µs within vars::BEGIN@3 which was called: # once (15µs+0s) by Config::BEGIN@11 at line 3
use 5.006;
# spent 15µs making 1 call to vars::BEGIN@3
4
51600nsour $VERSION = '1.03';
6
72219µs2328µs
# spent 264µs (199+65) within vars::BEGIN@7 which was called: # once (199µs+65µs) by Config::BEGIN@11 at line 7
use warnings::register;
# spent 264µs making 1 call to vars::BEGIN@7 # spent 65µs making 1 call to warnings::register::import
82279µs226µs
# spent 16µs (6+10) within vars::BEGIN@8 which was called: # once (6µs+10µs) by Config::BEGIN@11 at line 8
use strict qw(vars subs);
# spent 16µs making 1 call to vars::BEGIN@8 # spent 10µs making 1 call to strict::import
9
10
# spent 411µs (335+76) within vars::import which was called 9 times, avg 46µs/call: # once (58µs+13µs) by NetAddr::IP::Lite::BEGIN@33 at line 33 of NetAddr/IP/Lite.pm # once (52µs+12µs) by Socket6::BEGIN@39 at line 39 of Socket6.pm # once (51µs+12µs) by NetAddr::IP::BEGIN@25 at line 25 of NetAddr/IP.pm # once (48µs+10µs) by NetAddr::IP::InetBase::BEGIN@8 at line 8 of NetAddr/IP/InetBase.pm # once (44µs+10µs) by NetAddr::IP::Util::BEGIN@8 at line 8 of NetAddr/IP/Util.pm # once (26µs+6µs) by Config::BEGIN@11 at line 11 of Config.pm # once (26µs+6µs) by NetAddr::IP::InetBase::BEGIN@125 at line 125 of NetAddr/IP/InetBase.pm # once (16µs+3µs) by NetAddr::IP::Util_IS::BEGIN@8 at line 8 of NetAddr/IP/Util_IS.pm # once (14µs+3µs) by base::BEGIN@4 at line 4 of base.pm
sub import {
1196µs my $callpack = caller;
12917µs my (undef, @imports) = @_;
1392µs my ($sym, $ch);
14938µs foreach (@imports) {
1535158µs3552µs if (($ch, $sym) = /^([\$\@\%\*\&])(.+)/) {
# spent 52µs making 35 calls to vars::CORE:match, avg 1µs/call
163552µs3513µs if ($sym =~ /\W/) {
# spent 13µs making 35 calls to vars::CORE:match, avg 380ns/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 }
283561µs3510µs $sym = "${callpack}::$sym" unless $sym =~ /::/;
# spent 10µs making 35 calls to vars::CORE:match, avg 297ns/call
29 *$sym =
30 ( $ch eq "\$" ? \$$sym
31 : $ch eq "\@" ? \@$sym
32 : $ch eq "\%" ? \%$sym
33 : $ch eq "\*" ? \*$sym
34 : $ch eq "\&" ? \&$sym
353594µ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 76µs within vars::CORE:match which was called 105 times, avg 720ns/call: # 35 times (52µs+0s) by vars::import at line 15, avg 1µs/call # 35 times (13µs+0s) by vars::import at line 16, avg 380ns/call # 35 times (10µs+0s) by vars::import at line 28, avg 297ns/call
sub vars::CORE:match; # opcode