← Index
NYTProf Performance Profile   « line view »
For /Users/timbo/perl5/perlbrew/perls/perl-5.18.2/bin/perlcritic
  Run on Sat Mar 19 22:12:22 2016
Reported on Sat Mar 19 22:14:11 2016

Filename/Users/timbo/perl5/perlbrew/perls/perl-5.18.2/lib/site_perl/5.18.2/Perl/Critic/Policy/Variables/RequireLexicalLoopIterators.pm
StatementsExecuted 2204 statements in 7.44ms
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
504118.70ms33.5msPerl::Critic::Policy::Variables::RequireLexicalLoopIterators::::violatesPerl::Critic::Policy::Variables::RequireLexicalLoopIterators::violates
144112.61ms1.43sPerl::Critic::Policy::Variables::RequireLexicalLoopIterators::::prepare_to_scan_documentPerl::Critic::Policy::Variables::RequireLexicalLoopIterators::prepare_to_scan_document
111644µs873µsPerl::Critic::Policy::Variables::RequireLexicalLoopIterators::::BEGIN@14Perl::Critic::Policy::Variables::RequireLexicalLoopIterators::BEGIN@14
14411282µs282µsPerl::Critic::Policy::Variables::RequireLexicalLoopIterators::::applies_toPerl::Critic::Policy::Variables::RequireLexicalLoopIterators::applies_to
11116µs16µsPerl::Critic::Policy::Variables::RequireLexicalLoopIterators::::BEGIN@10Perl::Critic::Policy::Variables::RequireLexicalLoopIterators::BEGIN@10
1117µs188µsPerl::Critic::Policy::Variables::RequireLexicalLoopIterators::::BEGIN@16Perl::Critic::Policy::Variables::RequireLexicalLoopIterators::BEGIN@16
1117µs19µsPerl::Critic::Policy::Variables::RequireLexicalLoopIterators::::BEGIN@11Perl::Critic::Policy::Variables::RequireLexicalLoopIterators::BEGIN@11
1117µs11µsPerl::Critic::Policy::Variables::RequireLexicalLoopIterators::::BEGIN@12Perl::Critic::Policy::Variables::RequireLexicalLoopIterators::BEGIN@12
1117µs27µsPerl::Critic::Policy::Variables::RequireLexicalLoopIterators::::BEGIN@13Perl::Critic::Policy::Variables::RequireLexicalLoopIterators::BEGIN@13
1117µs57µsPerl::Critic::Policy::Variables::RequireLexicalLoopIterators::::BEGIN@17Perl::Critic::Policy::Variables::RequireLexicalLoopIterators::BEGIN@17
1116µs8µsPerl::Critic::Policy::Variables::RequireLexicalLoopIterators::::default_severityPerl::Critic::Policy::Variables::RequireLexicalLoopIterators::default_severity
1112µs2µsPerl::Critic::Policy::Variables::RequireLexicalLoopIterators::::supported_parametersPerl::Critic::Policy::Variables::RequireLexicalLoopIterators::supported_parameters
0000s0sPerl::Critic::Policy::Variables::RequireLexicalLoopIterators::::default_themesPerl::Critic::Policy::Variables::RequireLexicalLoopIterators::default_themes
Call graph for these subroutines as a Graphviz dot language file.
Line State
ments
Time
on line
Calls Time
in subs
Code
1##############################################################################
2# $URL$
3# $Date$
4# $Author$
5# $Revision$
6##############################################################################
7
8package Perl::Critic::Policy::Variables::RequireLexicalLoopIterators;
9
10240µs116µs
# spent 16µs within Perl::Critic::Policy::Variables::RequireLexicalLoopIterators::BEGIN@10 which was called: # once (16µs+0s) by Module::Pluggable::Object::_require at line 10
use 5.006001;
11229µs230µs
# spent 19µs (7+11) within Perl::Critic::Policy::Variables::RequireLexicalLoopIterators::BEGIN@11 which was called: # once (7µs+11µs) by Module::Pluggable::Object::_require at line 11
use strict;
# spent 19µs making 1 call to Perl::Critic::Policy::Variables::RequireLexicalLoopIterators::BEGIN@11 # spent 12µs making 1 call to strict::import
12218µs214µs
# spent 11µs (7+4) within Perl::Critic::Policy::Variables::RequireLexicalLoopIterators::BEGIN@12 which was called: # once (7µs+4µs) by Module::Pluggable::Object::_require at line 12
use warnings;
# spent 11µs making 1 call to Perl::Critic::Policy::Variables::RequireLexicalLoopIterators::BEGIN@12 # spent 4µs making 1 call to warnings::import
13219µs247µs
# spent 27µs (7+20) within Perl::Critic::Policy::Variables::RequireLexicalLoopIterators::BEGIN@13 which was called: # once (7µs+20µs) by Module::Pluggable::Object::_require at line 13
use Readonly;
# spent 27µs making 1 call to Perl::Critic::Policy::Variables::RequireLexicalLoopIterators::BEGIN@13 # spent 20µs making 1 call to Exporter::import
14296µs1873µs
# spent 873µs (644+229) within Perl::Critic::Policy::Variables::RequireLexicalLoopIterators::BEGIN@14 which was called: # once (644µs+229µs) by Module::Pluggable::Object::_require at line 14
use version ();
15
16224µs2368µs
# spent 188µs (7+180) within Perl::Critic::Policy::Variables::RequireLexicalLoopIterators::BEGIN@16 which was called: # once (7µs+180µs) by Module::Pluggable::Object::_require at line 16
use Perl::Critic::Utils qw{ :booleans :severities };
# spent 188µs making 1 call to Perl::Critic::Policy::Variables::RequireLexicalLoopIterators::BEGIN@16 # spent 180µs making 1 call to Exporter::import
172217µs2106µs
# spent 57µs (7+50) within Perl::Critic::Policy::Variables::RequireLexicalLoopIterators::BEGIN@17 which was called: # once (7µs+50µs) by Module::Pluggable::Object::_require at line 17
use base 'Perl::Critic::Policy';
# spent 57µs making 1 call to Perl::Critic::Policy::Variables::RequireLexicalLoopIterators::BEGIN@17 # spent 50µs making 1 call to base::import
18
191600nsour $VERSION = '1.121';
20
21#-----------------------------------------------------------------------------
22
2312µs129µsReadonly::Scalar my $DESC => q{Loop iterator is not lexical};
# spent 29µs making 1 call to Readonly::Scalar
2412µs142µsReadonly::Scalar my $EXPL => [ 108 ];
# spent 42µs making 1 call to Readonly::Scalar
25
26112µs227µsReadonly::Scalar my $MINIMUM_PERL_VERSION => version->new( 5.004 );
# spent 22µs making 1 call to Readonly::Scalar # spent 6µs making 1 call to version::new
27
28#-----------------------------------------------------------------------------
29
3015µs
# spent 2µs within Perl::Critic::Policy::Variables::RequireLexicalLoopIterators::supported_parameters which was called: # once (2µs+0s) by Perl::Critic::Policy::new at line 88 of Perl/Critic/Policy.pm
sub supported_parameters { return () }
3112µs
# spent 8µs (6+1) within Perl::Critic::Policy::Variables::RequireLexicalLoopIterators::default_severity which was called: # once (6µs+1µs) by Perl::Critic::Policy::get_severity at line 331 of Perl/Critic/Policy.pm
sub default_severity { return $SEVERITY_HIGHEST }
32sub default_themes { return qw(core pbp bugs certrec ) }
33144405µs
# spent 282µs within Perl::Critic::Policy::Variables::RequireLexicalLoopIterators::applies_to which was called 144 times, avg 2µs/call: # 144 times (282µs+0s) by Perl::Critic::_critique at line 165 of Perl/Critic.pm, avg 2µs/call
sub applies_to { return 'PPI::Statement::Compound' }
34
35#-----------------------------------------------------------------------------
36
37
# spent 1.43s (2.61ms+1.43) within Perl::Critic::Policy::Variables::RequireLexicalLoopIterators::prepare_to_scan_document which was called 144 times, avg 9.92ms/call: # 144 times (2.61ms+1.43s) by Perl::Critic::_critique at line 157 of Perl/Critic.pm, avg 9.92ms/call
sub prepare_to_scan_document {
3814457µs my ( $self, $document ) = @_;
39 # perl5004delta says that is when lexical iterators were introduced,
40 # so ... (RT 67760)
41144549µs1441.42s my $version = $document->highest_explicit_perl_version();
# spent 1.42s making 144 calls to Perl::Critic::Document::highest_explicit_perl_version, avg 9.89ms/call
421442.75ms7102.25ms return ! $version || $version >= $MINIMUM_PERL_VERSION;
# spent 1.32ms making 142 calls to version::(<=>, avg 9µs/call # spent 546µs making 426 calls to Readonly::Scalar::FETCH, avg 1µs/call # spent 385µs making 142 calls to version::(bool, avg 3µs/call
43}
44
45#-----------------------------------------------------------------------------
46
47
# spent 33.5ms (8.70+24.8) within Perl::Critic::Policy::Variables::RequireLexicalLoopIterators::violates which was called 504 times, avg 66µs/call: # 504 times (8.70ms+24.8ms) by Perl::Critic::_critique at line 183 of Perl/Critic.pm, avg 66µs/call
sub violates {
48504171µs my ( $self, $elem, undef ) = @_;
49
50 # First child will be 'for' or 'foreach' keyword
515041.40ms50421.4ms return if $elem->type() ne 'foreach';
# spent 21.4ms making 504 calls to PPI::Statement::Compound::type, avg 43µs/call
52
5386116µs86482µs my $first_child = $elem->schild(0);
# spent 482µs making 86 calls to PPI::Node::schild, avg 6µs/call
5486242µs8653µs return if not $first_child;
# spent 53µs making 86 calls to PPI::Util::TRUE, avg 612ns/call
5586306µs8691µs my $start = $first_child->isa('PPI::Token::Label') ? 1 : 0;
# spent 91µs making 86 calls to UNIVERSAL::isa, avg 1µs/call
56
5786113µs861.09ms my $potential_scope = $elem->schild($start + 1);
# spent 1.09ms making 86 calls to PPI::Node::schild, avg 13µs/call
5886232µs8651µs return if not $potential_scope;
# spent 51µs making 86 calls to PPI::Util::TRUE, avg 590ns/call
5986328µs86134µs return if $potential_scope->isa('PPI::Structure::List');
# spent 124µs making 83 calls to UNIVERSAL::isa, avg 1µs/call # spent 10µs making 3 calls to PPI::Structure::List::isa, avg 3µs/call
60
6183302µs831.42ms return if $potential_scope eq 'my';
# spent 1.42ms making 83 calls to PPI::Element::__eq, avg 17µs/call
62
63 return $self->violation( $DESC, $EXPL, $elem );
64}
65
66#-----------------------------------------------------------------------------
67
6814µs1;
69
70__END__