Profile of strict.pm

← Index
NYTProf Performance Profile «line view»
For scripts/bench.pl
Run on Mon Oct 22 16:48:56 2018
Reported on Mon Oct 22 16:49:10 2018

Filename | /usr/share/perl/5.26/strict.pm
Statements | Executed 127 statements in 1.18ms

Subroutines
Calls | P | F | Exclusive Time | Inclusive Time | Subroutine
--- | --- | --- | --- | --- | ---
1 | 1 | 1 | 130µs | 144µs | strict::::BEGIN@7strict::BEGIN@7
9 | 2 | 1 | 89µs | 89µs | strict::::bitsstrict::bits
8 | 8 | 5 | 73µs | 149µs | strict::::unimportstrict::unimport
7 | 7 | 7 | 43µs | 57µs | strict::::importstrict::import
1 | 1 | 1 | 14µs | 14µs | strict::::CORE:matchstrict::CORE:match (opcode)
0 | 0 | 0 | 0s | 0s | strict::::__ANON__[:31]strict::__ANON__[:31]
0 | 0 | 0 | 0s | 0s | strict::::__ANON__[:37]strict::__ANON__[:37]

Call graph for these subroutines as a Graphviz dot language file.

Line | State ments | Time on line | Calls | Time in subs | Code
--- | --- | --- | --- | --- | ---
1 |  |  |  |  | package strict;
2 |  |  |  |  |
3 | 1 | 2µs |  |  | $strict::VERSION = "1.11";
4 |  |  |  |  |
5 | 1 | 800ns |  |  | my ( %bitmask, %explicit_bitmask );
6 |  |  |  |  |
7 |  |  |  |  | # spent 144µs (130+14) within strict::BEGIN@7 which was called: # once (130µs+14µs) by Time::HiRes::BEGIN@4 at line 38 BEGIN {
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 | 38µs | 1 | 14µs | die sprintf "Incorrect use of pragma '%s' at %s line %d.\n", __PACKAGE__, +(caller)[1,2] # spent 14µ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 | 7µs |  |  | %bitmask = (
16 |  |  |  |  | refs => 0x00000002,
17 |  |  |  |  | subs => 0x00000200,
18 |  |  |  |  | vars => 0x00000400,
19 |  |  |  |  | );
20 |  |  |  |  |
21 | 1 | 3µs |  |  | %explicit_bitmask = (
22 |  |  |  |  | refs => 0x00000020,
23 |  |  |  |  | subs => 0x00000040,
24 |  |  |  |  | vars => 0x00000080,
25 |  |  |  |  | );
26 |  |  |  |  |
27 | 1 | 1µs |  |  | my $bits = 0;
28 | 1 | 11µs |  |  | $bits |= $_ for values %bitmask;
29 |  |  |  |  |
30 | 1 | 600ns |  |  | my $inline_all_bits = $bits;
31 | 1 | 29µs |  |  | *all_bits = sub () { $inline_all_bits };
32 |  |  |  |  |
33 | 1 | 500ns |  |  | $bits = 0;
34 | 1 | 5µs |  |  | $bits |= $_ for values %explicit_bitmask;
35 |  |  |  |  |
36 | 1 | 600ns |  |  | my $inline_all_explicit_bits = $bits;
37 | 1 | 22µs |  |  | *all_explicit_bits = sub () { $inline_all_explicit_bits };
38 | 1 | 780µs | 1 | 144µs | } # spent 144µs making 1 call to strict::BEGIN@7
39 |  |  |  |  |
40 |  |  |  |  | # spent 89µs within strict::bits which was called 9 times, avg 10µs/call: # 8 times (76µs+0s) by strict::unimport at line 69, avg 9µs/call # once (14µs+0s) by strict::import at line 62 sub bits {
41 | 9 | 5µs |  |  | my $bits = 0;
42 | 9 | 4µs |  |  | my @wrong;
43 | 9 | 10µs |  |  | foreach my $s (@_) {
44 | 10 | 17µs |  |  | if (exists $bitmask{$s}) {
45 | 10 | 19µs |  |  | $^H |= $explicit_bitmask{$s};
46 |  |  |  |  |
47 | 10 | 6µs |  |  | $bits |= $bitmask{$s};
48 |  |  |  |  | }
49 |  |  |  |  | else {
50 |  |  |  |  | push @wrong, $s;
51 |  |  |  |  | }
52 |  |  |  |  | }
53 | 9 | 6µs |  |  | if (@wrong) {
54 |  |  |  |  | require Carp;
55 |  |  |  |  | Carp::croak("Unknown 'strict' tag(s) '@wrong'");
56 |  |  |  |  | }
57 | 9 | 51µs |  |  | $bits;
58 |  |  |  |  | }
59 |  |  |  |  |
60 |  |  |  |  | # spent 57µs (43+14) within strict::import which was called 7 times, avg 8µs/call: # once (10µs+14µs) by vars::BEGIN@8 at line 8 of vars.pm # once (14µs+0s) by Time::HiRes::BEGIN@4 at line 4 of Time/HiRes.pm # once (6µs+0s) by Config::BEGIN@9 at line 9 of Config.pm # once (4µs+0s) by Exporter::Heavy::BEGIN@3 at line 3 of Exporter/Heavy.pm # once (3µs+0s) by constant::BEGIN@3 at line 3 of constant.pm # once (3µs+0s) by List::Util::BEGIN@9 at line 9 of List/Util.pm # once (2µs+0s) by Scalar::Util::BEGIN@9 at line 9 of Scalar/Util.pm sub import {
61 | 7 | 4µs |  |  | shift;
62 | 7 | 72µs | 1 | 14µs | $^H |= @_ ? &bits : all_bits | all_explicit_bits; # spent 14µs making 1 call to strict::bits
63 |  |  |  |  | }
64 |  |  |  |  |
65 |  |  |  |  | # spent 149µs (73+76) within strict::unimport which was called 8 times, avg 19µs/call: # once (28µs+23µs) by Time::HiRes::BEGIN@48 at line 48 of Time/HiRes.pm # once (11µs+12µs) by Config::BEGIN@47 at line 47 of Config.pm # once (5µs+10µs) by constant::BEGIN@90 at line 90 of constant.pm # once (8µs+7µs) by Exporter::Heavy::BEGIN@4 at line 4 of Exporter/Heavy.pm # once (6µs+7µs) by constant::BEGIN@40 at line 40 of constant.pm # once (5µs+6µs) by List::Util::BEGIN@31 at line 31 of List/Util.pm # once (5µs+6µs) by constant::BEGIN@65 at line 65 of constant.pm # once (5µs+5µs) by constant::BEGIN@141 at line 141 of constant.pm sub unimport {
66 | 8 | 4µs |  |  | shift;
67 |  |  |  |  |
68 | 8 | 36µs |  |  | if (@_) {
69 | 8 | 25µs | 8 | 76µs | $^H &= ~&bits; # spent 76µs making 8 calls to strict::bits, avg 9µs/call
70 |  |  |  |  | }
71 |  |  |  |  | else {
72 |  |  |  |  | $^H &= ~all_bits;
73 |  |  |  |  | $^H |= all_explicit_bits;
74 |  |  |  |  | }
75 |  |  |  |  | }
76 |  |  |  |  |
77 | 1 | 15µs |  |  | 1;
78 |  |  |  |  | __END__
|  |  |  |  | # spent 14µs within strict::CORE:match which was called: # once (14µs+0s) by strict::BEGIN@7 at line 11 sub strict::CORE:match; # opcode