| Filename | /usr/local/lib/perl5/5.36/vars.pm |
| Statements | Executed 92 statements in 618µs |
| Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
|---|---|---|---|---|---|
| 2 | 2 | 2 | 176µs | 225µs | vars::import |
| 57 | 3 | 1 | 50µs | 50µs | vars::CORE:match (opcode) |
| 1 | 1 | 1 | 15µs | 15µs | vars::BEGIN@3 |
| 1 | 1 | 1 | 9µs | 30µs | vars::BEGIN@7 |
| 1 | 1 | 1 | 5µs | 11µs | vars::BEGIN@8 |
| Line | State ments |
Time on line |
Calls | Time in subs |
Code |
|---|---|---|---|---|---|
| 1 | package vars; | ||||
| 2 | |||||
| 3 | 2 | 61µs | 1 | 15µs | # spent 15µs within vars::BEGIN@3 which was called:
# once (15µs+0s) by DynaLoader::BEGIN@28 at line 3 # spent 15µs making 1 call to vars::BEGIN@3 |
| 4 | |||||
| 5 | 1 | 700ns | our $VERSION = '1.05'; | ||
| 6 | |||||
| 7 | 2 | 26µs | 2 | 50µs | # spent 30µs (9+21) within vars::BEGIN@7 which was called:
# once (9µs+21µs) by DynaLoader::BEGIN@28 at line 7 # spent 30µs making 1 call to vars::BEGIN@7
# spent 21µs making 1 call to warnings::register::import |
| 8 | 2 | 302µs | 2 | 16µs | # spent 11µs (5+5) within vars::BEGIN@8 which was called:
# once (5µs+5µs) by DynaLoader::BEGIN@28 at line 8 # spent 11µs making 1 call to vars::BEGIN@8
# spent 5µs making 1 call to strict::import |
| 9 | |||||
| 10 | # spent 225µs (176+50) within vars::import which was called 2 times, avg 113µs/call:
# once (129µs+37µs) by DynaLoader::BEGIN@28 at line 30 of DynaLoader.pm
# once (47µs+13µs) by DBI::Const::GetInfoType::BEGIN@16 at line 16 of DBI/Const/GetInfoType.pm | ||||
| 11 | 2 | 2µs | my $callpack = caller; | ||
| 12 | 2 | 4µs | my (undef, @imports) = @_; | ||
| 13 | 2 | 900ns | my ($sym, $ch); | ||
| 14 | 2 | 9µs | foreach (@imports) { | ||
| 15 | 19 | 83µs | 19 | 29µs | if (($ch, $sym) = /^([\$\@\%\*\&])(.+)/) { # spent 29µs making 19 calls to vars::CORE:match, avg 2µs/call |
| 16 | 19 | 36µs | 19 | 11µs | if ($sym =~ /\W/) { # spent 11µs making 19 calls to vars::CORE:match, avg 568ns/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 | 19 | 46µs | 19 | 10µs | $sym = "${callpack}::$sym" unless $sym =~ /::/; # spent 10µs making 19 calls to vars::CORE:match, avg 532ns/call |
| 29 | *$sym = | ||||
| 30 | ( $ch eq "\$" ? \$$sym | ||||
| 31 | : $ch eq "\@" ? \@$sym | ||||
| 32 | : $ch eq "\%" ? \%$sym | ||||
| 33 | : $ch eq "\*" ? \*$sym | ||||
| 34 | : $ch eq "\&" ? \&$sym | ||||
| 35 | 19 | 46µ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 |