| Filename | /home/lbr/.plenv/versions/5.20.2/lib/perl5/5.20.2/strict.pm |
| Statements | Executed 249 statements in 304µs |
| Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
|---|---|---|---|---|---|
| 18 | 2 | 1 | 117µs | 117µs | strict::bits |
| 11 | 11 | 11 | 57µs | 140µs | strict::import |
| 7 | 7 | 3 | 31µs | 66µs | strict::unimport |
| 1 | 1 | 1 | 19µs | 19µs | strict::CORE:regcomp (opcode) |
| 1 | 1 | 1 | 4µs | 4µs | strict::CORE:match (opcode) |
| Line | State ments |
Time on line |
Calls | Time in subs |
Code |
|---|---|---|---|---|---|
| 1 | package strict; | ||||
| 2 | |||||
| 3 | 1 | 400ns | $strict::VERSION = "1.08"; | ||
| 4 | |||||
| 5 | # Verify that we're called correctly so that strictures will work. | ||||
| 6 | 1 | 38µs | 2 | 23µs | unless ( __FILE__ =~ /(^|[\/\\])\Q${\__PACKAGE__}\E\.pmc?$/ ) { # spent 19µs making 1 call to strict::CORE:regcomp
# spent 4µs making 1 call to strict::CORE:match |
| 7 | # Can't use Carp, since Carp uses us! | ||||
| 8 | my (undef, $f, $l) = caller; | ||||
| 9 | die("Incorrect use of pragma '${\__PACKAGE__}' at $f line $l.\n"); | ||||
| 10 | } | ||||
| 11 | |||||
| 12 | 1 | 2µs | my %bitmask = ( | ||
| 13 | refs => 0x00000002, | ||||
| 14 | subs => 0x00000200, | ||||
| 15 | vars => 0x00000400 | ||||
| 16 | ); | ||||
| 17 | 1 | 600ns | my %explicit_bitmask = ( | ||
| 18 | refs => 0x00000020, | ||||
| 19 | subs => 0x00000040, | ||||
| 20 | vars => 0x00000080 | ||||
| 21 | ); | ||||
| 22 | |||||
| 23 | sub bits { | ||||
| 24 | 18 | 7µs | my $bits = 0; | ||
| 25 | 18 | 3µs | my @wrong; | ||
| 26 | 18 | 15µs | foreach my $s (@_) { | ||
| 27 | 39 | 18µs | if (exists $bitmask{$s}) { | ||
| 28 | 39 | 28µs | $^H |= $explicit_bitmask{$s}; | ||
| 29 | } | ||||
| 30 | else { push @wrong, $s }; | ||||
| 31 | 39 | 25µs | $bits |= $bitmask{$s} || 0; | ||
| 32 | } | ||||
| 33 | 18 | 6µs | if (@wrong) { | ||
| 34 | require Carp; | ||||
| 35 | Carp::croak("Unknown 'strict' tag(s) '@wrong'"); | ||||
| 36 | } | ||||
| 37 | 18 | 48µs | $bits; | ||
| 38 | } | ||||
| 39 | |||||
| 40 | 1 | 600ns | my @default_bits = qw(refs subs vars); | ||
| 41 | |||||
| 42 | # spent 140µs (57+83) within strict::import which was called 11 times, avg 13µs/call:
# once (12µs+7µs) by constant::BEGIN@3 at line 3 of constant.pm
# once (6µs+10µs) by PerlIO::encoding::BEGIN@3 at line 3 of PerlIO/encoding.pm
# once (6µs+9µs) by Config::BEGIN@9 at line 9 of Config.pm
# once (5µs+10µs) by Encode::BEGIN@5 at line 5 of Encode.pm
# once (6µs+8µs) by vars::BEGIN@8 at line 8 of vars.pm
# once (5µs+8µs) by Encode::Config::BEGIN@7 at line 7 of Encode/Config.pm
# once (4µs+6µs) by Encode::Encoding::BEGIN@4 at line 4 of Encode/Encoding.pm
# once (4µs+7µs) by Encode::Alias::BEGIN@2 at line 2 of Encode/Alias.pm
# once (3µs+6µs) by lib::BEGIN@8 at line 8 of lib.pm
# once (3µs+6µs) by Petal::Tiny::BEGIN@4 at line 4 of lib/Petal/Tiny.pm
# once (3µs+5µs) by Carp::BEGIN@4 at line 4 of Carp.pm | ||||
| 43 | 11 | 2µs | shift; | ||
| 44 | 11 | 52µs | 11 | 83µs | $^H |= bits(@_ ? @_ : @default_bits); # spent 83µs making 11 calls to strict::bits, avg 8µs/call |
| 45 | } | ||||
| 46 | |||||
| 47 | # spent 66µs (31+34) within strict::unimport which was called 7 times, avg 9µs/call:
# once (6µs+5µs) by constant::BEGIN@39 at line 39 of constant.pm
# once (5µs+6µs) by Config::BEGIN@47 at line 47 of Config.pm
# once (5µs+6µs) by Carp::BEGIN@555 at line 555 of Carp.pm
# once (4µs+5µs) by Carp::BEGIN@131 at line 131 of Carp.pm
# once (4µs+5µs) by constant::BEGIN@126 at line 126 of constant.pm
# once (4µs+4µs) by constant::BEGIN@64 at line 64 of constant.pm
# once (3µs+4µs) by Carp::BEGIN@575 at line 575 of Carp.pm | ||||
| 48 | 7 | 2µs | shift; | ||
| 49 | 7 | 26µs | 7 | 34µs | $^H &= ~ bits(@_ ? @_ : @default_bits); # spent 34µs making 7 calls to strict::bits, avg 5µs/call |
| 50 | } | ||||
| 51 | |||||
| 52 | 1 | 33µs | 1; | ||
| 53 | __END__ | ||||
# spent 4µs within strict::CORE:match which was called:
# once (4µs+0s) by Config::BEGIN@9 at line 6 | |||||
# spent 19µs within strict::CORE:regcomp which was called:
# once (19µs+0s) by Config::BEGIN@9 at line 6 |