Filename | /usr/share/perl/5.26/strict.pm |
Statements | Executed 123 statements in 604µs |
Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
---|---|---|---|---|---|
9 | 1 | 1 | 64µs | 64µs | bits | strict::
9 | 9 | 4 | 63µs | 127µs | unimport | strict::
1 | 1 | 1 | 61µs | 68µs | BEGIN@7 | strict::
5 | 5 | 5 | 22µs | 22µs | import | strict::
1 | 1 | 1 | 8µs | 8µs | CORE:match (opcode) | strict::
0 | 0 | 0 | 0s | 0s | __ANON__[:31] | strict::
0 | 0 | 0 | 0s | 0s | __ANON__[:37] | strict::
Line | State ments |
Time on line |
Calls | Time in subs |
Code |
---|---|---|---|---|---|
1 | package strict; | ||||
2 | |||||
3 | 1 | 800ns | $strict::VERSION = "1.11"; | ||
4 | |||||
5 | 1 | 400ns | my ( %bitmask, %explicit_bitmask ); | ||
6 | |||||
7 | # spent 68µs (61+8) within strict::BEGIN@7 which was called:
# once (61µs+8µs) by main::BEGIN@23 at line 38 | ||||
8 | # Verify that we're called correctly so that strictures will work. | ||||
9 | # Can't use Carp, since Carp uses us! | ||||
10 | # see also warnings.pm. | ||||
11 | 1 | 19µs | 1 | 8µs | die sprintf "Incorrect use of pragma '%s' at %s line %d.\n", __PACKAGE__, +(caller)[1,2] # spent 8µs making 1 call to strict::CORE:match |
12 | if __FILE__ !~ ( '(?x) \b '.__PACKAGE__.' \.pmc? \z' ) | ||||
13 | && __FILE__ =~ ( '(?x) \b (?i:'.__PACKAGE__.') \.pmc? \z' ); | ||||
14 | |||||
15 | 1 | 3µs | %bitmask = ( | ||
16 | refs => 0x00000002, | ||||
17 | subs => 0x00000200, | ||||
18 | vars => 0x00000400, | ||||
19 | ); | ||||
20 | |||||
21 | 1 | 1µs | %explicit_bitmask = ( | ||
22 | refs => 0x00000020, | ||||
23 | subs => 0x00000040, | ||||
24 | vars => 0x00000080, | ||||
25 | ); | ||||
26 | |||||
27 | 1 | 600ns | my $bits = 0; | ||
28 | 1 | 5µs | $bits |= $_ for values %bitmask; | ||
29 | |||||
30 | 1 | 300ns | my $inline_all_bits = $bits; | ||
31 | 1 | 14µs | *all_bits = sub () { $inline_all_bits }; | ||
32 | |||||
33 | 1 | 300ns | $bits = 0; | ||
34 | 1 | 2µs | $bits |= $_ for values %explicit_bitmask; | ||
35 | |||||
36 | 1 | 400ns | my $inline_all_explicit_bits = $bits; | ||
37 | 1 | 16µs | *all_explicit_bits = sub () { $inline_all_explicit_bits }; | ||
38 | 1 | 347µs | 1 | 68µs | } # spent 68µs making 1 call to strict::BEGIN@7 |
39 | |||||
40 | # spent 64µs within strict::bits which was called 9 times, avg 7µs/call:
# 9 times (64µs+0s) by strict::unimport at line 69, avg 7µs/call | ||||
41 | 9 | 4µs | my $bits = 0; | ||
42 | 9 | 3µs | my @wrong; | ||
43 | 9 | 8µs | foreach my $s (@_) { | ||
44 | 9 | 12µs | if (exists $bitmask{$s}) { | ||
45 | 9 | 14µs | $^H |= $explicit_bitmask{$s}; | ||
46 | |||||
47 | 9 | 5µs | $bits |= $bitmask{$s}; | ||
48 | } | ||||
49 | else { | ||||
50 | push @wrong, $s; | ||||
51 | } | ||||
52 | } | ||||
53 | 9 | 5µs | if (@wrong) { | ||
54 | require Carp; | ||||
55 | Carp::croak("Unknown 'strict' tag(s) '@wrong'"); | ||||
56 | } | ||||
57 | 9 | 39µs | $bits; | ||
58 | } | ||||
59 | |||||
60 | # spent 22µs within strict::import which was called 5 times, avg 4µs/call:
# once (7µs+0s) by main::BEGIN@23 at line 23 of /homes/dcw/src/perl/weeklychallenge/perlweeklychallenge-club/challenge-025/duncan-c-white/perl5/v1.pl
# once (4µs+0s) by constant::BEGIN@3 at line 3 of constant.pm
# once (4µs+0s) by Scalar::Util::BEGIN@9 at line 9 of Scalar/Util.pm
# once (4µs+0s) by List::Util::BEGIN@9 at line 9 of List/Util.pm
# once (4µs+0s) by Carp::BEGIN@4 at line 4 of Carp.pm | ||||
61 | 5 | 2µs | shift; | ||
62 | 5 | 40µs | $^H |= @_ ? &bits : all_bits | all_explicit_bits; | ||
63 | } | ||||
64 | |||||
65 | # spent 127µs (63+64) within strict::unimport which was called 9 times, avg 14µs/call:
# once (10µs+10µs) by Carp::BEGIN@132 at line 132 of Carp.pm
# once (10µs+9µs) by Carp::BEGIN@592 at line 592 of Carp.pm
# once (8µs+8µs) by Function::Parameters::BEGIN@80 at line 80 of Function/Parameters.pm
# once (7µs+8µs) by List::Util::BEGIN@31 at line 31 of List/Util.pm
# once (6µs+7µs) by Carp::BEGIN@612 at line 612 of Carp.pm
# once (6µs+7µs) by constant::BEGIN@40 at line 40 of constant.pm
# once (5µs+5µs) by constant::BEGIN@90 at line 90 of constant.pm
# once (5µs+5µs) by constant::BEGIN@141 at line 141 of constant.pm
# once (5µs+5µs) by constant::BEGIN@65 at line 65 of constant.pm | ||||
66 | 9 | 3µs | shift; | ||
67 | |||||
68 | 9 | 34µs | if (@_) { | ||
69 | 9 | 19µs | 9 | 64µs | $^H &= ~&bits; # spent 64µs making 9 calls to strict::bits, avg 7µs/call |
70 | } | ||||
71 | else { | ||||
72 | $^H &= ~all_bits; | ||||
73 | $^H |= all_explicit_bits; | ||||
74 | } | ||||
75 | } | ||||
76 | |||||
77 | 1 | 7µs | 1; | ||
78 | __END__ | ||||
# spent 8µs within strict::CORE:match which was called:
# once (8µs+0s) by strict::BEGIN@7 at line 11 |