← 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/Number/Float.pm
StatementsExecuted 5555 statements in 6.31ms
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
1018115.29ms13.3msPPI::Token::Number::Float::::__TOKENIZER__on_charPPI::Token::Number::Float::__TOKENIZER__on_char
102021697µs697µsPPI::Token::Number::Float::::CORE:matchPPI::Token::Number::Float::CORE:match (opcode)
11111µs23µsPPI::Token::Number::Float::::BEGIN@31PPI::Token::Number::Float::BEGIN@31
1118µs8µsPPI::Token::Number::Float::::BEGIN@35PPI::Token::Number::Float::BEGIN@35
1116µs34µsPPI::Token::Number::Float::::BEGIN@34PPI::Token::Number::Float::BEGIN@34
1113µs3µsPPI::Token::Number::Float::::BEGIN@32PPI::Token::Number::Float::BEGIN@32
0000s0sPPI::Token::Number::Float::::literalPPI::Token::Number::Float::literal
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::Number::Float;
2
3=pod
4
5=head1 NAME
6
7PPI::Token::Number::Float - Token class for a floating-point number
8
9=head1 SYNOPSIS
10
11 $n = 1.234;
12
13=head1 INHERITANCE
14
15 PPI::Token::Number::Float
16 isa PPI::Token::Number
17 isa PPI::Token
18 isa PPI::Element
19
20=head1 DESCRIPTION
21
22The C<PPI::Token::Number::Float> class is used for tokens that
23represent floating point numbers. A float is identified by n decimal
24point. Exponential notation (the C<e> or C<E>) is handled by the
25PPI::Token::Number::Exp class.
26
27=head1 METHODS
28
29=cut
30
31218µs234µs
# spent 23µs (11+12) within PPI::Token::Number::Float::BEGIN@31 which was called: # once (11µs+12µs) by PPI::Token::BEGIN@46 at line 31
use strict;
# spent 23µs making 1 call to PPI::Token::Number::Float::BEGIN@31 # spent 12µs making 1 call to strict::import
32218µs13µs
# spent 3µs within PPI::Token::Number::Float::BEGIN@32 which was called: # once (3µs+0s) by PPI::Token::BEGIN@46 at line 32
use PPI::Token::Number ();
# spent 3µs making 1 call to PPI::Token::Number::Float::BEGIN@32
33
34227µs261µs
# spent 34µs (6+28) within PPI::Token::Number::Float::BEGIN@34 which was called: # once (6µs+28µs) by PPI::Token::BEGIN@46 at line 34
use vars qw{$VERSION @ISA};
# spent 34µs making 1 call to PPI::Token::Number::Float::BEGIN@34 # spent 28µs making 1 call to vars::import
35
# spent 8µs within PPI::Token::Number::Float::BEGIN@35 which was called: # once (8µs+0s) by PPI::Token::BEGIN@46 at line 38
BEGIN {
361300ns $VERSION = '1.215';
3718µs @ISA = 'PPI::Token::Number';
381218µs18µs}
# spent 8µs making 1 call to PPI::Token::Number::Float::BEGIN@35
39
40=pod
41
42=head2 base
43
44Returns the base for the number: 10.
45
46=cut
47
48sub base () { 10 }
49
50=pod
51
52=head2 literal
53
54Return the numeric value of this token.
55
56=cut
57
58sub literal {
59 my $self = shift;
60 my $str = $self->_literal;
61 my $neg = $str =~ s/^\-//;
62 $str =~ s/^\./0./;
63 my $val = 0+$str;
64 return $neg ? -$val : $val;
65}
66
- -
71#####################################################################
72# Tokenizer Methods
73
74
# spent 13.3ms (5.29+8.04) within PPI::Token::Number::Float::__TOKENIZER__on_char which was called 1018 times, avg 13µs/call: # 1018 times (5.29ms+8.04ms) by PPI::Tokenizer::_process_next_char at line 554 of PPI/Tokenizer.pm, avg 13µs/call
sub __TOKENIZER__on_char {
751018287µs my $class = shift;
761018134µs my $t = shift;
771018446µs my $char = substr( $t->{line}, $t->{line_cursor}, 1 );
78
79 # Allow underscores straight through
801018153µs return 1 if $char eq '_';
81
82 # Allow digits
8310184.22ms1018694µs return 1 if $char =~ /\d/o;
# spent 694µs making 1018 calls to PPI::Token::Number::Float::CORE:match, avg 681ns/call
84
85 # Is there a second decimal point? Then version string or '..' operator
8615049µs if ( $char eq '.' ) {
87210µs23µs if ( $t->{token}->{content} =~ /\.$/ ) {
# spent 3µs making 2 calls to PPI::Token::Number::Float::CORE:match, avg 1µs/call
88 # We have a .., which is an operator.
89 # Take the . off the end of the token..
90 # and finish it, then make the .. operator.
9122µs chop $t->{token}->{content};
9228µs216µs $t->{class} = $t->{token}->set_class( 'Number' );
# spent 16µs making 2 calls to PPI::Token::set_class, avg 8µs/call
9323µs222µs $t->_new_token('Operator', '..');
# spent 22µs making 2 calls to PPI::Tokenizer::_new_token, avg 11µs/call
9424µs return 0;
95 } elsif ( $t->{token}->{content} !~ /_/ ) {
96 # Underscore means not a Version, fall through to end token
97 $t->{class} = $t->{token}->set_class( 'Number::Version' );
98 return 1;
99 }
100 }
10114869µs if ($char eq 'e' || $char eq 'E') {
102 $t->{class} = $t->{token}->set_class( 'Number::Exp' );
103 return 1;
104 }
105
106 # Doesn't fit a special case, or is after the end of the token
107 # End of token.
108148630µs2967.30ms $t->_finalize_token->__TOKENIZER__on_char( $t );
# spent 6.79ms making 148 calls to PPI::Token::Whitespace::__TOKENIZER__on_char, avg 46µs/call # spent 513µs making 148 calls to PPI::Tokenizer::_finalize_token, avg 3µs/call
109}
110
11112µs1;
112
113=pod
114
115=head1 SUPPORT
116
117See the L<support section|PPI/SUPPORT> in the main module.
118
119=head1 AUTHOR
120
121Chris Dolan E<lt>cdolan@cpan.orgE<gt>
122
123=head1 COPYRIGHT
124
125Copyright 2006 Chris Dolan.
126
127This program is free software; you can redistribute
128it and/or modify it under the same terms as Perl itself.
129
130The full text of the license can be found in the
131LICENSE file included with this module.
132
133=cut
 
# spent 697µs within PPI::Token::Number::Float::CORE:match which was called 1020 times, avg 683ns/call: # 1018 times (694µs+0s) by PPI::Token::Number::Float::__TOKENIZER__on_char at line 83, avg 681ns/call # 2 times (3µs+0s) by PPI::Token::Number::Float::__TOKENIZER__on_char at line 87, avg 1µs/call
sub PPI::Token::Number::Float::CORE:match; # opcode