Profile of vars.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/vars.pm
Statements | Executed 20 statements in 1.45ms

Subroutines
Calls | P | F | Exclusive Time | Inclusive Time | Subroutine
--- | --- | --- | --- | --- | ---
1 | 1 | 1 | 442µs | 620µs | vars::::BEGIN@7vars::BEGIN@7
1 | 1 | 1 | 62µs | 78µs | vars::::importvars::import
1 | 1 | 1 | 30µs | 30µs | vars::::BEGIN@3vars::BEGIN@3
6 | 3 | 1 | 15µs | 15µs | vars::::CORE:matchvars::CORE:match (opcode)
1 | 1 | 1 | 13µs | 36µs | vars::::BEGIN@8vars::BEGIN@8

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

Line | State ments | Time on line | Calls | Time in subs | Code
--- | --- | --- | --- | --- | ---
1 |  |  |  |  | package vars;
2 |  |  |  |  |
3 | 2 | 114µs | 1 | 30µs | # spent 30µs within vars::BEGIN@3 which was called: # once (30µs+0s) by Config::BEGIN@11 at line 3 use 5.006; # spent 30µs making 1 call to vars::BEGIN@3
4 |  |  |  |  |
5 | 1 | 1µs |  |  | our $VERSION = '1.03';
6 |  |  |  |  |
7 | 2 | 485µs | 2 | 797µs | # spent 620µs (442+177) within vars::BEGIN@7 which was called: # once (442µs+177µs) by Config::BEGIN@11 at line 7 use warnings::register; # spent 620µs making 1 call to vars::BEGIN@7 # spent 177µs making 1 call to warnings::register::import
8 | 2 | 759µs | 2 | 60µs | # spent 36µs (13+24) within vars::BEGIN@8 which was called: # once (13µs+24µs) by Config::BEGIN@11 at line 8 use strict qw(vars subs); # spent 36µs making 1 call to vars::BEGIN@8 # spent 24µs making 1 call to strict::import
9 |  |  |  |  |
10 |  |  |  |  | # spent 78µs (62+15) within vars::import which was called: # once (62µs+15µs) by Config::BEGIN@11 at line 11 of Config.pm sub import {
11 | 1 | 2µs |  |  | my $callpack = caller;
12 | 1 | 3µs |  |  | my (undef, @imports) = @_;
13 | 1 | 500ns |  |  | my ($sym, $ch);
14 | 1 | 7µs |  |  | foreach (@imports) {
15 | 2 | 34µs | 2 | 10µs | if (($ch, $sym) = /^([\$\@\%\*\&])(.+)/) { # spent 10µs making 2 calls to vars::CORE:match, avg 5µs/call
16 | 2 | 9µs | 2 | 3µs | if ($sym =~ /\W/) { # spent 3µs making 2 calls to vars::CORE:match, avg 2µs/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 | 2 | 9µs | 2 | 2µs | $sym = "${callpack}::$sym" unless $sym =~ /::/; # spent 2µs making 2 calls to vars::CORE:match, avg 900ns/call
29 |  |  |  |  | *$sym =
30 |  |  |  |  | ( $ch eq "\$" ? \$$sym
31 |  |  |  |  | : $ch eq "\@" ? \@$sym
32 |  |  |  |  | : $ch eq "\%" ? \%$sym
33 |  |  |  |  | : $ch eq "\*" ? \*$sym
34 |  |  |  |  | : $ch eq "\&" ? \&$sym
35 | 2 | 15µ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 | 8µs |  |  | 1;
47 |  |  |  |  | __END__
|  |  |  |  | # spent 15µs within vars::CORE:match which was called 6 times, avg 3µs/call: # 2 times (10µs+0s) by vars::import at line 15, avg 5µs/call # 2 times (3µs+0s) by vars::import at line 16, avg 2µs/call # 2 times (2µs+0s) by vars::import at line 28, avg 900ns/call sub vars::CORE:match; # opcode