Profile of vars.pm

← Index
NYTProf Performance Profile «block view•line view•sub view»
For bin/dpath
Run on Tue Jun 5 15:31:33 2012
Reported on Tue Jun 5 15:31:37 2012

Filename | /home/ss5/perl5/perlbrew/perls/perl-5.14.1/lib/5.14.1/vars.pm
Statements | Executed 180 statements in 4.66ms

Subroutines
Calls | P | F | Exclusive Time | Inclusive Time | Subroutine
--- | --- | --- | --- | --- | ---
13 | 13 | 13 | 1.72ms | 2.22ms | vars::::importvars::import
1 | 1 | 1 | 780µs | 1.20ms | vars::::BEGIN@7vars::BEGIN@7
90 | 3 | 1 | 502µs | 502µs | vars::::CORE:matchvars::CORE:match (opcode)
1 | 1 | 1 | 72µs | 72µs | vars::::BEGIN@3vars::BEGIN@3
1 | 1 | 1 | 27µs | 75µ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 | 218µs | 1 | 72µs | # spent 72µs within vars::BEGIN@3 which was called: # once (72µs+0s) by Attribute::Handlers::BEGIN@6 at line 3 use 5.006; # spent 72µs making 1 call to vars::BEGIN@3
4 |  |  |  |  |
5 | 1 | 3µs |  |  | our $VERSION = '1.02';
6 |  |  |  |  |
7 | 2 | 848µs | 2 | 1.62ms | # spent 1.20ms (780µs+418µs) within vars::BEGIN@7 which was called: # once (780µs+418µs) by Attribute::Handlers::BEGIN@6 at line 7 use warnings::register; # spent 1.20ms making 1 call to vars::BEGIN@7 # spent 418µs making 1 call to warnings::register::import
8 | 2 | 1.27ms | 2 | 122µs | # spent 75µs (27+48) within vars::BEGIN@8 which was called: # once (27µs+48µs) by Attribute::Handlers::BEGIN@6 at line 8 use strict qw(vars subs); # spent 75µs making 1 call to vars::BEGIN@8 # spent 48µs making 1 call to strict::import
9 |  |  |  |  |
10 |  |  |  |  | # spent 2.22ms (1.72+502µs) within vars::import which was called 13 times, avg 171µs/call: # once (237µs+66µs) by POSIX::SigRt::BEGIN@60 at line 60 of POSIX.pm # once (198µs+57µs) by Params::Util::BEGIN@65 at line 65 of Params/Util.pm # once (191µs+55µs) by List::MoreUtils::BEGIN@8 at line 8 of List/MoreUtils.pm # once (146µs+46µs) by Iterator::Util::BEGIN@21 at line 21 of Iterator/Util.pm # once (149µs+42µs) by Text::Balanced::BEGIN@11 at line 11 of Text/Balanced.pm # once (139µs+36µs) by Attribute::Handlers::BEGIN@6 at line 6 of Attribute/Handlers.pm # once (125µs+38µs) by File::Spec::BEGIN@4 at line 4 of File/Spec.pm # once (132µs+21µs) by File::Spec::Unix::BEGIN@4 at line 4 of File/Spec/Unix.pm # once (108µs+36µs) by constant::BEGIN@6 at line 6 of constant.pm # once (73µs+29µs) by SelfLoader::BEGIN@9 at line 9 of SelfLoader.pm # once (75µs+25µs) by Class::Data::Inheritable::BEGIN@4 at line 4 of Class/Data/Inheritable.pm # once (73µs+26µs) by base::BEGIN@4 at line 4 of base.pm # once (74µs+25µs) by Config::BEGIN@11 at line 11 of Config.pm sub import {
11 | 172 | 2.31ms |  |  | my $callpack = caller;
12 |  |  |  |  | my (undef, @imports) = @_;
13 |  |  |  |  | my ($sym, $ch);
14 |  |  |  |  | foreach (@imports) {
15 |  |  | 30 | 335µs | if (($ch, $sym) = /^([\$\@\%\*\&])(.+)/) { # spent 335µs making 30 calls to vars::CORE:match, avg 11µs/call
16 |  |  | 30 | 85µs | if ($sym =~ /\W/) { # spent 85µs making 30 calls to vars::CORE:match, avg 3µ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 |  |  | 30 | 82µs | $sym = "${callpack}::$sym" unless $sym =~ /::/; # spent 82µs making 30 calls to vars::CORE:match, avg 3µs/call
29 |  |  |  |  | *$sym =
30 |  |  |  |  | ( $ch eq "\$" ? \$$sym
31 |  |  |  |  | : $ch eq "\@" ? \@$sym
32 |  |  |  |  | : $ch eq "\%" ? \%$sym
33 |  |  |  |  | : $ch eq "\*" ? \*$sym
34 |  |  |  |  | : $ch eq "\&" ? \&$sym
35 |  |  |  |  | : 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 | 12µs |  |  | 1;
47 |  |  |  |  | __END__
|  |  |  |  | # spent 502µs within vars::CORE:match which was called 90 times, avg 6µs/call: # 30 times (335µs+0s) by vars::import at line 15, avg 11µs/call # 30 times (85µs+0s) by vars::import at line 16, avg 3µs/call # 30 times (82µs+0s) by vars::import at line 28, avg 3µs/call sub vars::CORE:match; # opcode