| Filename | /usr/share/perl/5.18/vars.pm |
| Statements | Executed 84 statements in 977µs |
| Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
|---|---|---|---|---|---|
| 1 | 1 | 1 | 245µs | 353µs | vars::BEGIN@7 |
| 6 | 6 | 6 | 213µs | 265µs | vars::import |
| 39 | 3 | 1 | 51µs | 51µs | vars::CORE:match (opcode) |
| 1 | 1 | 1 | 19µs | 19µs | vars::BEGIN@3 |
| 1 | 1 | 1 | 10µs | 25µs | vars::BEGIN@8 |
| 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 Config::BEGIN@11 at line 3 # spent 19µs making 1 call to vars::BEGIN@3 |
| 4 | |||||
| 5 | 1 | 800ns | our $VERSION = '1.03'; | ||
| 6 | |||||
| 7 | 2 | 271µs | 2 | 461µs | # spent 353µs (245+108) within vars::BEGIN@7 which was called:
# once (245µs+108µs) by Config::BEGIN@11 at line 7 # spent 353µs making 1 call to vars::BEGIN@7
# spent 108µs making 1 call to warnings::register::import |
| 8 | 2 | 362µs | 2 | 40µs | # spent 25µs (10+15) within vars::BEGIN@8 which was called:
# once (10µs+15µs) by Config::BEGIN@11 at line 8 # spent 25µs making 1 call to vars::BEGIN@8
# spent 15µs making 1 call to strict::import |
| 9 | |||||
| 10 | # spent 265µs (213+51) within vars::import which was called 6 times, avg 44µs/call:
# once (54µs+14µs) by Params::Util::BEGIN@65 at line 65 of Params/Util.pm
# once (46µs+11µs) by Digest::MD5::BEGIN@4 at line 4 of Digest/MD5.pm
# once (37µs+9µs) by Config::BEGIN@11 at line 11 of Config.pm
# once (30µs+8µs) by constant::BEGIN@6 at line 6 of constant.pm
# once (26µs+5µs) by base::BEGIN@4 at line 4 of base.pm
# once (19µs+5µs) by Digest::base::BEGIN@4 at line 4 of Digest/base.pm | ||||
| 11 | 6 | 6µs | my $callpack = caller; | ||
| 12 | 6 | 11µs | my (undef, @imports) = @_; | ||
| 13 | 6 | 2µs | my ($sym, $ch); | ||
| 14 | 6 | 29µs | foreach (@imports) { | ||
| 15 | 13 | 104µs | 13 | 36µs | if (($ch, $sym) = /^([\$\@\%\*\&])(.+)/) { # spent 36µs making 13 calls to vars::CORE:match, avg 3µs/call |
| 16 | 13 | 32µs | 13 | 9µs | if ($sym =~ /\W/) { # spent 9µs making 13 calls to vars::CORE:match, avg 692ns/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 | 13 | 36µs | 13 | 6µs | $sym = "${callpack}::$sym" unless $sym =~ /::/; # spent 6µs making 13 calls to vars::CORE:match, avg 500ns/call |
| 29 | *$sym = | ||||
| 30 | ( $ch eq "\$" ? \$$sym | ||||
| 31 | : $ch eq "\@" ? \@$sym | ||||
| 32 | : $ch eq "\%" ? \%$sym | ||||
| 33 | : $ch eq "\*" ? \*$sym | ||||
| 34 | : $ch eq "\&" ? \&$sym | ||||
| 35 | 13 | 55µ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__ | ||||
sub vars::CORE:match; # opcode |