Profile of vars.pm

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

Filename | /home/s1/perl5/perlbrew/perls/perl-5.22.1/lib/5.22.1/vars.pm
Statements | Executed 152 statements in 1.08ms

Subroutines
Calls | P | F | Exclusive Time | Inclusive Time | Subroutine
--- | --- | --- | --- | --- | ---
9 | 9 | 9 | 390µs | 493µs | vars::::importvars::import
81 | 3 | 1 | 103µs | 103µs | vars::::CORE:matchvars::CORE:match (opcode)
1 | 1 | 1 | 27µs | 27µs | vars::::BEGIN@3vars::BEGIN@3
1 | 1 | 1 | 10µs | 109µs | vars::::BEGIN@7vars::BEGIN@7
1 | 1 | 1 | 9µs | 25µ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 | 93µs | 1 | 27µs | # spent 27µs within vars::BEGIN@3 which was called: # once (27µs+0s) by version::BEGIN@11 at line 3 use 5.006; # spent 27µs making 1 call to vars::BEGIN@3
4 |  |  |  |  |
5 | 1 | 700ns |  |  | our $VERSION = '1.03';
6 |  |  |  |  |
7 | 2 | 41µs | 2 | 209µs | # spent 109µs (10+99) within vars::BEGIN@7 which was called: # once (10µs+99µs) by version::BEGIN@11 at line 7 use warnings::register; # spent 109µs making 1 call to vars::BEGIN@7 # spent 99µs making 1 call to warnings::register::import
8 | 2 | 430µs | 2 | 41µs | # spent 25µs (9+16) within vars::BEGIN@8 which was called: # once (9µs+16µs) by version::BEGIN@11 at line 8 use strict qw(vars subs); # spent 25µs making 1 call to vars::BEGIN@8 # spent 16µs making 1 call to strict::import
9 |  |  |  |  |
10 |  |  |  |  | # spent 493µs (390+103) within vars::import which was called 9 times, avg 55µs/call: # once (88µs+22µs) by version::BEGIN@11 at line 11 of version.pm # once (63µs+18µs) by DateTime::TimeZone::Catalog::BEGIN@12 at line 12 of DateTime/TimeZone/Catalog.pm # once (54µs+15µs) by version::regex::BEGIN@5 at line 5 of version/regex.pm # once (49µs+12µs) by Params::Validate::BEGIN@14 at line 14 of Params/Validate.pm # once (42µs+11µs) by version::vxs::BEGIN@7 at line 7 of version/vxs.pm # once (31µs+8µs) by File::Spec::BEGIN@4 at line 4 of File/Spec.pm # once (22µs+6µs) by base::BEGIN@5 at line 5 of base.pm # once (20µs+6µs) by File::Spec::Unix::BEGIN@4 at line 4 of File/Spec/Unix.pm # once (19µs+5µs) by parent::BEGIN@3 at line 3 of parent.pm sub import {
11 | 9 | 10µs |  |  | my $callpack = caller;
12 | 9 | 21µs |  |  | my (undef, @imports) = @_;
13 | 9 | 3µs |  |  | my ($sym, $ch);
14 | 9 | 52µs |  |  | foreach (@imports) {
15 | 27 | 184µs | 27 | 72µs | if (($ch, $sym) = /^([\$\@\%\*\&])(.+)/) { # spent 72µs making 27 calls to vars::CORE:match, avg 3µs/call
16 | 27 | 61µs | 27 | 18µs | if ($sym =~ /\W/) { # spent 18µs making 27 calls to vars::CORE:match, avg 659ns/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 | 27 | 73µs | 27 | 13µs | $sym = "${callpack}::$sym" unless $sym =~ /::/; # spent 13µs making 27 calls to vars::CORE:match, avg 467ns/call
29 |  |  |  |  | *$sym =
30 |  |  |  |  | ( $ch eq "\$" ? \$$sym
31 |  |  |  |  | : $ch eq "\@" ? \@$sym
32 |  |  |  |  | : $ch eq "\%" ? \%$sym
33 |  |  |  |  | : $ch eq "\*" ? \*$sym
34 |  |  |  |  | : $ch eq "\&" ? \&$sym
35 | 27 | 111µ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 | 4µs |  |  | 1;
47 |  |  |  |  | __END__
|  |  |  |  | # spent 103µs within vars::CORE:match which was called 81 times, avg 1µs/call: # 27 times (72µs+0s) by vars::import at line 15, avg 3µs/call # 27 times (18µs+0s) by vars::import at line 16, avg 659ns/call # 27 times (13µs+0s) by vars::import at line 28, avg 467ns/call sub vars::CORE:match; # opcode