| Filename | /home/ss5/perl5/perlbrew/perls/perl-5.14.1/lib/5.14.1/vars.pm |
| Statements | Executed 212 statements in 4.10ms |
| Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
|---|---|---|---|---|---|
| 12 | 12 | 12 | 1.90ms | 2.44ms | vars::import |
| 117 | 3 | 1 | 538µs | 538µs | vars::CORE:match (opcode) |
| 1 | 1 | 1 | 72µs | 72µs | vars::BEGIN@3 |
| 1 | 1 | 1 | 30µs | 480µs | vars::BEGIN@7 |
| 1 | 1 | 1 | 25µs | 76µs | vars::BEGIN@8 |
| Line | State ments |
Time on line |
Calls | Time in subs |
Code |
|---|---|---|---|---|---|
| 1 | package vars; | ||||
| 2 | |||||
| 3 | 2 | 230µs | 1 | 72µs | # spent 72µs within vars::BEGIN@3 which was called:
# once (72µs+0s) by Config::BEGIN@11 at line 3 # spent 72µs making 1 call to vars::BEGIN@3 |
| 4 | |||||
| 5 | 1 | 3µs | our $VERSION = '1.02'; | ||
| 6 | |||||
| 7 | 2 | 107µs | 2 | 929µs | # spent 480µs (30+450) within vars::BEGIN@7 which was called:
# once (30µs+450µs) by Config::BEGIN@11 at line 7 # spent 480µs making 1 call to vars::BEGIN@7
# spent 450µs making 1 call to warnings::register::import |
| 8 | 2 | 1.23ms | 2 | 126µs | # spent 76µs (25+51) within vars::BEGIN@8 which was called:
# once (25µs+51µs) by Config::BEGIN@11 at line 8 # spent 76µs making 1 call to vars::BEGIN@8
# spent 51µs making 1 call to strict::import |
| 9 | |||||
| 10 | # spent 2.44ms (1.90+538µs) within vars::import which was called 12 times, avg 203µs/call:
# once (532µs+145µs) by YAML::Syck::BEGIN@5 at line 5 of YAML/Syck.pm
# once (257µs+62µs) by File::Spec::Functions::BEGIN@6 at line 6 of File/Spec/Functions.pm
# once (197µs+59µs) by Data::Structure::Util::BEGIN@7 at line 7 of Data/Structure/Util.pm
# once (154µs+44µs) by Digest::MD5::BEGIN@4 at line 4 of Digest/MD5.pm
# once (134µs+36µs) by Storable::BEGIN@22 at line 22 of Storable.pm
# once (115µs+34µs) by File::Spec::BEGIN@4 at line 4 of File/Spec.pm
# once (109µs+39µs) by constant::BEGIN@6 at line 6 of constant.pm
# once (109µs+30µs) by Config::General::BEGIN@37 at line 37 of Config/General.pm
# once (84µs+26µs) by Config::BEGIN@11 at line 11 of Config.pm
# once (73µs+26µs) by base::BEGIN@4 at line 4 of base.pm
# once (69µs+20µs) by Digest::base::BEGIN@4 at line 4 of Digest/base.pm
# once (70µs+16µs) by File::Spec::Unix::BEGIN@4 at line 4 of File/Spec/Unix.pm | ||||
| 11 | 12 | 40µs | my $callpack = caller; | ||
| 12 | 12 | 92µs | my (undef, @imports) = @_; | ||
| 13 | 12 | 15µs | my ($sym, $ch); | ||
| 14 | 12 | 208µs | foreach (@imports) { | ||
| 15 | 39 | 958µs | 39 | 360µs | if (($ch, $sym) = /^([\$\@\%\*\&])(.+)/) { # spent 360µs making 39 calls to vars::CORE:match, avg 9µs/call |
| 16 | 39 | 305µs | 39 | 92µs | if ($sym =~ /\W/) { # spent 92µs making 39 calls to vars::CORE:match, avg 2µs/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 | 39 | 353µs | 39 | 87µs | $sym = "${callpack}::$sym" unless $sym =~ /::/; # spent 87µs making 39 calls to vars::CORE:match, avg 2µs/call |
| 29 | *$sym = | ||||
| 30 | ( $ch eq "\$" ? \$$sym | ||||
| 31 | : $ch eq "\@" ? \@$sym | ||||
| 32 | : $ch eq "\%" ? \%$sym | ||||
| 33 | : $ch eq "\*" ? \*$sym | ||||
| 34 | : $ch eq "\&" ? \&$sym | ||||
| 35 | 39 | 547µ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 | 11µs | 1; | ||
| 47 | __END__ | ||||
sub vars::CORE:match; # opcode |