← 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:10 2016

Filename/Users/timbo/perl5/perlbrew/perls/perl-5.18.2/lib/site_perl/5.18.2/PPI/Token/Operator.pm
StatementsExecuted 73422 statements in 61.1ms
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
109075264.2ms300msPPI::Token::Operator::::__TOKENIZER__on_charPPI::Token::Operator::__TOKENIZER__on_char
11133µs33µsPPI::Token::Operator::::BEGIN@46PPI::Token::Operator::BEGIN@46
312126µs26µsPPI::Token::Operator::::CORE:matchPPI::Token::Operator::CORE:match (opcode)
11111µs25µsPPI::Token::Operator::::BEGIN@42PPI::Token::Operator::BEGIN@42
1116µs42µsPPI::Token::Operator::::BEGIN@45PPI::Token::Operator::BEGIN@45
1113µs3µsPPI::Token::Operator::::BEGIN@43PPI::Token::Operator::BEGIN@43
Call graph for these subroutines as a Graphviz dot language file.
Line State
ments
Time
on line
Calls Time
in subs
Code
1package PPI::Token::Operator;
2
3=pod
4
5=head1 NAME
6
7PPI::Token::Operator - Token class for operators
8
9=head1 INHERITANCE
10
11 PPI::Token::Operator
12 isa PPI::Token
13 isa PPI::Element
14
15=head1 SYNOPSIS
16
17 # This is the list of valid operators
18 ++ -- ** ! ~ + -
19 =~ !~ * / % x
20 << >> lt gt le ge cmp ~~
21 == != <=> . .. ... ,
22 & | ^ && || //
23 ? : = += -= *= .= //=
24 < > <= >= <> => ->
25 and or dor not eq ne
26
27=head1 DESCRIPTION
28
29All operators in PPI are created as C<PPI::Token::Operator> objects,
30including the ones that may superficially look like a L<PPI::Token::Word>
31object.
32
33=head1 METHODS
34
35There are no additional methods beyond those provided by the parent
36L<PPI::Token> and L<PPI::Element> classes.
37
38Got any ideas for methods? Submit a report to rt.cpan.org!
39
40=cut
41
42217µs238µs
# spent 25µs (11+14) within PPI::Token::Operator::BEGIN@42 which was called: # once (11µs+14µs) by PPI::Token::BEGIN@66 at line 42
use strict;
# spent 25µs making 1 call to PPI::Token::Operator::BEGIN@42 # spent 14µs making 1 call to strict::import
43218µs13µs
# spent 3µs within PPI::Token::Operator::BEGIN@43 which was called: # once (3µs+0s) by PPI::Token::BEGIN@66 at line 43
use PPI::Token ();
# spent 3µs making 1 call to PPI::Token::Operator::BEGIN@43
44
45259µs277µs
# spent 42µs (6+36) within PPI::Token::Operator::BEGIN@45 which was called: # once (6µs+36µs) by PPI::Token::BEGIN@66 at line 45
use vars qw{$VERSION @ISA %OPERATOR};
# spent 42µs making 1 call to PPI::Token::Operator::BEGIN@45 # spent 36µs making 1 call to vars::import
46
# spent 33µs within PPI::Token::Operator::BEGIN@46 which was called: # once (33µs+0s) by PPI::Token::BEGIN@66 at line 66
BEGIN {
471400ns $VERSION = '1.215';
4814µs @ISA = 'PPI::Token';
49
50 # Build the operator index
51 ### NOTE - This is accessed several times explicitly
52 ### in PPI::Token::Word. Do not rename this
53 ### without also correcting them.
54129µs %OPERATOR = map { $_ => 1 } (
55 qw{
56 -> ++ -- ** ! ~ + -
57 =~ !~ * / % x . << >>
58 < > <= >= lt gt le ge
59 == != <=> eq ne cmp ~~
60 & | ^ && || // .. ...
61 ? : = += -= *= .= /= //=
62 => <>
63 and or xor not
64 }, ',' # Avoids "comma in qw{}" warning
65 );
661176µs133µs}
# spent 33µs making 1 call to PPI::Token::Operator::BEGIN@46
67
- -
72#####################################################################
73# Tokenizer Methods
74
75
# spent 300ms (64.2+236) within PPI::Token::Operator::__TOKENIZER__on_char which was called 10907 times, avg 28µs/call: # 10634 times (63.4ms+236ms) by PPI::Tokenizer::_process_next_char at line 554 of PPI/Tokenizer.pm, avg 28µs/call # 139 times (396µs+0s) by PPI::Token::Unknown::__TOKENIZER__on_char at line 248 of PPI/Token/Unknown.pm, avg 3µs/call # 108 times (310µs+9µs) by PPI::Token::Unknown::__TOKENIZER__on_char at line 272 of PPI/Token/Unknown.pm, avg 3µs/call # 25 times (180µs+145µs) by PPI::Token::Unknown::__TOKENIZER__on_char at line 295 of PPI/Token/Unknown.pm, avg 13µs/call # once (7µs+5µs) by PPI::Token::Unknown::__TOKENIZER__on_char at line 222 of PPI/Token/Unknown.pm
sub __TOKENIZER__on_char {
76109071.59ms my $t = $_[1];
77109074.97ms my $char = substr( $t->{line}, $t->{line_cursor}, 1 );
78
79 # Are we still an operator if we add the next character
80109073.87ms my $content = $t->{token}->{content};
811090720.9ms return 1 if $OPERATOR{ $content . $char };
82
83 # Handle the special case of a .1234 decimal number
8474381.19ms if ( $content eq '.' ) {
8530104µs3024µs if ( $char =~ /^[0-9]$/ ) {
# spent 24µs making 30 calls to PPI::Token::Operator::CORE:match, avg 803ns/call
86 # This is a decimal number
87 $t->{class} = $t->{token}->set_class('Number::Float');
88 return $t->{class}->__TOKENIZER__on_char( $t );
89 }
90 }
91
92 # Handle the special case if we might be a here-doc
937438908µs if ( $content eq '<<' ) {
941900ns my $line = substr( $t->{line}, $t->{line_cursor} );
95 # Either <<FOO or << 'FOO' or <<\FOO
96 ### Is the zero-width look-ahead assertion really
97 ### supposed to be there?
9816µs11µs if ( $line =~ /^(?: (?!\d)\w | \s*['"`] | \\\w ) /x ) {
# spent 1µs making 1 call to PPI::Token::Operator::CORE:match
99 # This is a here-doc.
100 # Change the class and move to the HereDoc's own __TOKENIZER__on_char method.
10116µs19µs $t->{class} = $t->{token}->set_class('HereDoc');
# spent 9µs making 1 call to PPI::Token::set_class
10216µs1138µs return $t->{class}->__TOKENIZER__on_char( $t );
# spent 138µs making 1 call to PPI::Token::HereDoc::__TOKENIZER__on_char
103 }
104 }
105
106 # Handle the special case of the null Readline
1077437646µs if ( $content eq '<>' ) {
108 $t->{class} = $t->{token}->set_class('QuoteLike::Readline');
109 }
110
111 # Finalize normally
112743726.6ms14874236ms $t->_finalize_token->__TOKENIZER__on_char( $t );
# spent 219ms making 7437 calls to PPI::Token::Whitespace::__TOKENIZER__on_char, avg 29µs/call # spent 16.8ms making 7437 calls to PPI::Tokenizer::_finalize_token, avg 2µs/call
113}
114
11512µs1;
116
117=pod
118
119=head1 SUPPORT
120
121See the L<support section|PPI/SUPPORT> in the main module.
122
123=head1 AUTHOR
124
125Adam Kennedy E<lt>adamk@cpan.orgE<gt>
126
127=head1 COPYRIGHT
128
129Copyright 2001 - 2011 Adam Kennedy.
130
131This program is free software; you can redistribute
132it and/or modify it under the same terms as Perl itself.
133
134The full text of the license can be found in the
135LICENSE file included with this module.
136
137=cut
 
# spent 26µs within PPI::Token::Operator::CORE:match which was called 31 times, avg 823ns/call: # 30 times (24µs+0s) by PPI::Token::Operator::__TOKENIZER__on_char at line 85, avg 803ns/call # once (1µs+0s) by PPI::Token::Operator::__TOKENIZER__on_char at line 98
sub PPI::Token::Operator::CORE:match; # opcode