| Filename | /home/lbr/.plenv/versions/5.20.2/lib/perl5/5.20.2/vars.pm |
| Statements | Executed 20 statements in 316µs |
| Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
|---|---|---|---|---|---|
| 1 | 1 | 1 | 24µs | 29µs | vars::import |
| 1 | 1 | 1 | 10µs | 10µs | vars::BEGIN@3 |
| 6 | 3 | 1 | 5µs | 5µs | vars::CORE:match (opcode) |
| 1 | 1 | 1 | 5µs | 59µs | vars::BEGIN@7 |
| 1 | 1 | 1 | 4µs | 13µs | vars::BEGIN@8 |
| Line | State ments |
Time on line |
Calls | Time in subs |
Code |
|---|---|---|---|---|---|
| 1 | package vars; | ||||
| 2 | |||||
| 3 | 2 | 40µs | 1 | 10µs | # spent 10µs within vars::BEGIN@3 which was called:
# once (10µs+0s) by constant::BEGIN@6 at line 3 # spent 10µs making 1 call to vars::BEGIN@3 |
| 4 | |||||
| 5 | 1 | 400ns | our $VERSION = '1.03'; | ||
| 6 | |||||
| 7 | 2 | 18µs | 2 | 113µs | # spent 59µs (5+54) within vars::BEGIN@7 which was called:
# once (5µs+54µs) by constant::BEGIN@6 at line 7 # spent 59µs making 1 call to vars::BEGIN@7
# spent 54µs making 1 call to warnings::register::import |
| 8 | 2 | 224µs | 2 | 21µs | # spent 13µs (4+8) within vars::BEGIN@8 which was called:
# once (4µs+8µs) by constant::BEGIN@6 at line 8 # spent 13µs making 1 call to vars::BEGIN@8
# spent 8µs making 1 call to strict::import |
| 9 | |||||
| 10 | # spent 29µs (24+5) within vars::import which was called:
# once (24µs+5µs) by constant::BEGIN@6 at line 6 of constant.pm | ||||
| 11 | 1 | 600ns | my $callpack = caller; | ||
| 12 | 1 | 1µs | my (undef, @imports) = @_; | ||
| 13 | 1 | 200ns | my ($sym, $ch); | ||
| 14 | 1 | 3µs | foreach (@imports) { | ||
| 15 | 2 | 12µs | 2 | 4µs | if (($ch, $sym) = /^([\$\@\%\*\&])(.+)/) { # spent 4µs making 2 calls to vars::CORE:match, avg 2µs/call |
| 16 | 2 | 4µs | 2 | 1µs | if ($sym =~ /\W/) { # spent 1µs making 2 calls to vars::CORE:match, avg 500ns/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 | 2 | 4µs | 2 | 500ns | $sym = "${callpack}::$sym" unless $sym =~ /::/; # spent 500ns making 2 calls to vars::CORE:match, avg 250ns/call |
| 29 | *$sym = | ||||
| 30 | ( $ch eq "\$" ? \$$sym | ||||
| 31 | : $ch eq "\@" ? \@$sym | ||||
| 32 | : $ch eq "\%" ? \%$sym | ||||
| 33 | : $ch eq "\*" ? \*$sym | ||||
| 34 | : $ch eq "\&" ? \&$sym | ||||
| 35 | 2 | 5µ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 | 2µs | 1; | ||
| 47 | __END__ | ||||
sub vars::CORE:match; # opcode |