Profile of vars.pm

← Index
NYTProf Performance Profile «line view»
For -e
Run on Thu Jun 30 16:34:56 2016
Reported on Thu Jun 30 16:35:08 2016

Filename | /home/s1/perl5/perlbrew/perls/perl-5.22.1/lib/5.22.1/vars.pm
Statements | Executed 172 statements in 871µs

Subroutines
Calls | P | F | Exclusive Time | Inclusive Time | Subroutine
--- | --- | --- | --- | --- | ---
10 | 10 | 10 | 347µs | 441µs | vars::::importvars::import
93 | 3 | 1 | 94µs | 94µs | vars::::CORE:matchvars::CORE:match (opcode)
1 | 1 | 1 | 19µs | 19µs | vars::::BEGIN@3vars::BEGIN@3
1 | 1 | 1 | 7µs | 82µs | vars::::BEGIN@7vars::BEGIN@7
1 | 1 | 1 | 7µs | 19µs | vars::::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
--- | --- | --- | --- | --- | ---
1 |  |  |  |  | package vars;
2 |  |  |  |  |
3 | 2 | 65µs | 1 | 19µs | # spent 19µs within vars::BEGIN@3 which was called: # once (19µs+0s) by version::BEGIN@11 at line 3 use 5.006; # spent 19µs making 1 call to vars::BEGIN@3
4 |  |  |  |  |
5 | 1 | 500ns |  |  | our $VERSION = '1.03';
6 |  |  |  |  |
7 | 2 | 31µs | 2 | 156µs | # spent 82µs (7+74) within vars::BEGIN@7 which was called: # once (7µs+74µs) by version::BEGIN@11 at line 7 use warnings::register; # spent 82µs making 1 call to vars::BEGIN@7 # spent 74µs making 1 call to warnings::register::import
8 | 2 | 312µs | 2 | 31µs | # spent 19µs (7+12) within vars::BEGIN@8 which was called: # once (7µs+12µs) by version::BEGIN@11 at line 8 use strict qw(vars subs); # spent 19µs making 1 call to vars::BEGIN@8 # spent 12µs making 1 call to strict::import
9 |  |  |  |  |
10 |  |  |  |  | # spent 441µs (347+94) within vars::import which was called 10 times, avg 44µs/call: # once (66µs+16µs) by version::BEGIN@11 at line 11 of version.pm # once (54µs+15µs) by DateTime::TimeZone::Catalog::BEGIN@12 at line 12 of DateTime/TimeZone/Catalog.pm # once (44µs+11µs) by Class::Inspector::BEGIN@50 at line 50 of Class/Inspector.pm # once (39µs+11µs) by version::regex::BEGIN@5 at line 5 of version/regex.pm # once (34µs+8µs) by Params::Validate::BEGIN@14 at line 14 of Params/Validate.pm # once (30µs+11µs) by File::Spec::BEGIN@4 at line 4 of File/Spec.pm # once (32µs+8µs) by version::vxs::BEGIN@7 at line 7 of version/vxs.pm # once (18µs+5µs) by base::BEGIN@5 at line 5 of base.pm # once (15µs+4µs) by File::Spec::Unix::BEGIN@4 at line 4 of File/Spec/Unix.pm # once (14µs+4µs) by parent::BEGIN@3 at line 3 of parent.pm sub import {
11 | 10 | 9µs |  |  | my $callpack = caller;
12 | 10 | 17µs |  |  | my (undef, @imports) = @_;
13 | 10 | 3µs |  |  | my ($sym, $ch);
14 | 10 | 45µs |  |  | foreach (@imports) {
15 | 31 | 164µs | 31 | 65µs | if (($ch, $sym) = /^([\$\@\%\*\&])(.+)/) { # spent 65µs making 31 calls to vars::CORE:match, avg 2µs/call
16 | 31 | 58µs | 31 | 17µs | if ($sym =~ /\W/) { # spent 17µs making 31 calls to vars::CORE:match, avg 558ns/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 |  |  |  |  | }
28 | 31 | 67µs | 31 | 12µs | $sym = "${callpack}::$sym" unless $sym =~ /::/; # spent 12µs making 31 calls to vars::CORE:match, avg 374ns/call
29 |  |  |  |  | *$sym =
30 |  |  |  |  | ( $ch eq "\$" ? \$$sym
31 |  |  |  |  | : $ch eq "\@" ? \@$sym
32 |  |  |  |  | : $ch eq "\%" ? \%$sym
33 |  |  |  |  | : $ch eq "\*" ? \*$sym
34 |  |  |  |  | : $ch eq "\&" ? \&$sym
35 | 31 | 97µ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 |  |  |  |  |
46 | 1 | 3µs |  |  | 1;
47 |  |  |  |  | __END__
|  |  |  |  | # spent 94µs within vars::CORE:match which was called 93 times, avg 1µs/call: # 31 times (65µs+0s) by vars::import at line 15, avg 2µs/call # 31 times (17µs+0s) by vars::import at line 16, avg 558ns/call # 31 times (12µs+0s) by vars::import at line 28, avg 374ns/call sub vars::CORE:match; # opcode