| Filename | /home/ss5/perl5/perlbrew/perls/perl-5.22.0/lib/5.22.0/vars.pm |
| Statements | Executed 432 statements in 1.17ms |
| Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
|---|---|---|---|---|---|
| 28 | 28 | 22 | 639µs | 780µs | vars::import |
| 234 | 3 | 1 | 142µs | 142µs | vars::CORE:match (opcode) |
| 1 | 1 | 1 | 119µs | 187µs | vars::BEGIN@7 |
| 1 | 1 | 1 | 9µs | 9µs | vars::BEGIN@3 |
| 1 | 1 | 1 | 4µs | 11µs | vars::BEGIN@8 |
| Line | State ments |
Time on line |
Calls | Time in subs |
Code |
|---|---|---|---|---|---|
| 1 | package vars; | ||||
| 2 | |||||
| 3 | 2 | 33µs | 1 | 9µs | # spent 9µs within vars::BEGIN@3 which was called:
# once (9µs+0s) by Attribute::Handlers::BEGIN@6 at line 3 # spent 9µs making 1 call to vars::BEGIN@3 |
| 4 | |||||
| 5 | 1 | 300ns | our $VERSION = '1.03'; | ||
| 6 | |||||
| 7 | 2 | 130µs | 2 | 256µs | # spent 187µs (119+69) within vars::BEGIN@7 which was called:
# once (119µs+69µs) by Attribute::Handlers::BEGIN@6 at line 7 # spent 187µs making 1 call to vars::BEGIN@7
# spent 69µs making 1 call to warnings::register::import |
| 8 | 2 | 186µs | 2 | 19µs | # spent 11µs (4+8) within vars::BEGIN@8 which was called:
# once (4µs+8µs) by Attribute::Handlers::BEGIN@6 at line 8 # spent 11µs making 1 call to vars::BEGIN@8
# spent 8µs making 1 call to strict::import |
| 9 | |||||
| 10 | # spent 780µs (639+142) within vars::import which was called 28 times, avg 28µs/call:
# once (66µs+13µs) by Getopt::Long::BEGIN@45 at line 45 of Getopt/Long.pm
# once (50µs+10µs) by File::HomeDir::BEGIN@13 at line 13 of File/HomeDir.pm
# once (42µs+8µs) by Getopt::Long::BEGIN@51 at line 51 of Getopt/Long.pm
# once (41µs+8µs) by Getopt::Long::BEGIN@48 at line 48 of Getopt/Long.pm
# once (29µs+6µs) by Getopt::Long::BEGIN@46 at line 46 of Getopt/Long.pm
# once (25µs+9µs) by List::MoreUtils::XS::BEGIN@7 at line 7 of List/MoreUtils/XS.pm
# once (28µs+5µs) by Params::Util::BEGIN@65 at line 65 of Params/Util.pm
# once (26µs+5µs) by DBI::Const::GetInfoType::BEGIN@16 at line 16 of DBI/Const/GetInfoType.pm
# once (25µs+5µs) by Getopt::Long::BEGIN@26 at line 26 of Getopt/Long.pm
# once (24µs+6µs) by Regexp::Common::BEGIN@19 at line 19 of Regexp/Common.pm
# once (24µs+5µs) by Digest::MD5::BEGIN@4 at line 4 of Digest/MD5.pm
# once (24µs+5µs) by File::Spec::Functions::BEGIN@6 at line 6 of File/Spec/Functions.pm
# once (19µs+7µs) by File::Spec::BEGIN@4 at line 4 of File/Spec.pm
# once (20µs+6µs) by Attribute::Handlers::BEGIN@6 at line 6 of Attribute/Handlers.pm
# once (20µs+5µs) by IO::Select::BEGIN@11 at line 11 of IO/Select.pm
# once (17µs+4µs) by Getopt::Long::BEGIN@19 at line 19 of Getopt/Long.pm
# once (16µs+4µs) by File::HomeDir::Driver::BEGIN@10 at line 10 of File/HomeDir/Driver.pm
# once (16µs+3µs) by parent::BEGIN@3 at line 3 of parent.pm
# once (16µs+3µs) by List::MoreUtils::PP::BEGIN@327 at line 327 of List/MoreUtils/PP.pm
# once (15µs+4µs) by base::BEGIN@5 at line 5 of base.pm
# once (14µs+5µs) by Config::BEGIN@11 at line 11 of Config.pm
# once (16µs+3µs) by File::HomeDir::FreeDesktop::BEGIN@15 at line 15 of File/HomeDir/FreeDesktop.pm
# once (14µs+3µs) by File::HomeDir::Unix::BEGIN@10 at line 10 of File/HomeDir/Unix.pm
# once (15µs+2µs) by Getopt::Long::BEGIN@22 at line 22 of Getopt/Long.pm
# once (10µs+2µs) by B::Deparse::BEGIN@51 at line 51 of B/Deparse.pm
# once (9µs+2µs) by Regexp::Common::delimited::BEGIN@8 at line 8 of Regexp/Common/delimited.pm
# once (9µs+2µs) by Digest::base::BEGIN@4 at line 4 of Digest/base.pm
# once (8µs+2µs) by File::Spec::Unix::BEGIN@4 at line 4 of File/Spec/Unix.pm | ||||
| 11 | 28 | 18µs | my $callpack = caller; | ||
| 12 | 28 | 30µs | my (undef, @imports) = @_; | ||
| 13 | 28 | 5µs | my ($sym, $ch); | ||
| 14 | 28 | 91µs | foreach (@imports) { | ||
| 15 | 78 | 266µs | 78 | 95µs | if (($ch, $sym) = /^([\$\@\%\*\&])(.+)/) { # spent 95µs making 78 calls to vars::CORE:match, avg 1µs/call |
| 16 | 78 | 101µs | 78 | 27µs | if ($sym =~ /\W/) { # spent 27µs making 78 calls to vars::CORE:match, avg 350ns/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 | 78 | 118µs | 78 | 19µs | $sym = "${callpack}::$sym" unless $sym =~ /::/; # spent 19µs making 78 calls to vars::CORE:match, avg 247ns/call |
| 29 | *$sym = | ||||
| 30 | ( $ch eq "\$" ? \$$sym | ||||
| 31 | : $ch eq "\@" ? \@$sym | ||||
| 32 | : $ch eq "\%" ? \%$sym | ||||
| 33 | : $ch eq "\*" ? \*$sym | ||||
| 34 | : $ch eq "\&" ? \&$sym | ||||
| 35 | 78 | 185µ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 |