← Index
NYTProf Performance Profile   « block view • line view • sub view »
For -e
  Run on Wed Nov 17 21:45:08 2010
Reported on Wed Nov 17 22:10:15 2010

Filename/home/doy/perl5/perlbrew/perls/perl-5.10.1/lib/site_perl/5.10.1/x86_64-linux/Moose/Meta/Method/Accessor/Native/String/substr.pm
StatementsExecuted 20 statements in 2.53ms
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
11181µs100µsMoose::Meta::Method::Accessor::Native::String::substr::::BEGIN@3Moose::Meta::Method::Accessor::Native::String::substr::BEGIN@3
11149µs800µsMoose::Meta::Method::Accessor::Native::String::substr::::BEGIN@128Moose::Meta::Method::Accessor::Native::String::substr::BEGIN@128
11143µs14.7msMoose::Meta::Method::Accessor::Native::String::substr::::BEGIN@12Moose::Meta::Method::Accessor::Native::String::substr::BEGIN@12
11142µs111µsMoose::Meta::Method::Accessor::Native::String::substr::::BEGIN@4Moose::Meta::Method::Accessor::Native::String::substr::BEGIN@4
11120µs20µsMoose::Meta::Method::Accessor::Native::String::substr::::BEGIN@6Moose::Meta::Method::Accessor::Native::String::substr::BEGIN@6
0000s0sMoose::Meta::Method::Accessor::Native::String::substr::::_generate_methodMoose::Meta::Method::Accessor::Native::String::substr::_generate_method
0000s0sMoose::Meta::Method::Accessor::Native::String::substr::::_inline_check_argumentsMoose::Meta::Method::Accessor::Native::String::substr::_inline_check_arguments
0000s0sMoose::Meta::Method::Accessor::Native::String::substr::::_inline_optimized_set_new_valueMoose::Meta::Method::Accessor::Native::String::substr::_inline_optimized_set_new_value
0000s0sMoose::Meta::Method::Accessor::Native::String::substr::::_inline_process_argumentsMoose::Meta::Method::Accessor::Native::String::substr::_inline_process_arguments
0000s0sMoose::Meta::Method::Accessor::Native::String::substr::::_maximum_argumentsMoose::Meta::Method::Accessor::Native::String::substr::_maximum_arguments
0000s0sMoose::Meta::Method::Accessor::Native::String::substr::::_minimum_argumentsMoose::Meta::Method::Accessor::Native::String::substr::_minimum_arguments
0000s0sMoose::Meta::Method::Accessor::Native::String::substr::::_potential_valueMoose::Meta::Method::Accessor::Native::String::substr::_potential_value
0000s0sMoose::Meta::Method::Accessor::Native::String::substr::::_return_valueMoose::Meta::Method::Accessor::Native::String::substr::_return_value
Call graph for these subroutines as a Graphviz dot language file.
Line State
ments
Time
on line
Calls Time
in subs
Code
1package Moose::Meta::Method::Accessor::Native::String::substr;
2
33120µs2118µs
# spent 100µs (81+18) within Moose::Meta::Method::Accessor::Native::String::substr::BEGIN@3 which was called: # once (81µs+18µs) by Moose::Meta::Attribute::Native::Trait::String::BEGIN@17 at line 3
use strict;
# spent 100µs making 1 call to Moose::Meta::Method::Accessor::Native::String::substr::BEGIN@3 # spent 18µs making 1 call to strict::import
43100µs2179µs
# spent 111µs (42+68) within Moose::Meta::Method::Accessor::Native::String::substr::BEGIN@4 which was called: # once (42µs+68µs) by Moose::Meta::Attribute::Native::Trait::String::BEGIN@17 at line 4
use warnings;
# spent 111µs making 1 call to Moose::Meta::Method::Accessor::Native::String::substr::BEGIN@4 # spent 68µs making 1 call to warnings::import
5
63219µs120µs
# spent 20µs within Moose::Meta::Method::Accessor::Native::String::substr::BEGIN@6 which was called: # once (20µs+0s) by Moose::Meta::Attribute::Native::Trait::String::BEGIN@17 at line 6
use Moose::Util ();
7
814µsour $VERSION = '1.19';
9186µs$VERSION = eval $VERSION;
# spent 12µs executing statements in string eval
1014µsour $AUTHORITY = 'cpan:STEVAN';
11
1231.77ms229.4ms
# spent 14.7ms (43µs+14.7) within Moose::Meta::Method::Accessor::Native::String::substr::BEGIN@12 which was called: # once (43µs+14.7ms) by Moose::Meta::Attribute::Native::Trait::String::BEGIN@17 at line 12
use Moose::Role;
13
14151µs153.7mswith 'Moose::Meta::Method::Accessor::Native::Reader' => {
# spent 53.7ms making 1 call to Moose::Role::with
15 -excludes => [
16 qw( _generate_method
17 _minimum_arguments
18 _maximum_arguments
19 _inline_process_arguments
20 _inline_check_arguments
21 _return_value
22 )
23 ]
24 },
25 'Moose::Meta::Method::Accessor::Native::Writer' => {
26 -excludes => [
27 qw(
28 _generate_method
29 _minimum_arguments
30 _maximum_arguments
31 _inline_process_arguments
32 _inline_check_arguments
33 _inline_optimized_set_new_value
34 _return_value
35 )
36 ]
37 };
38
39sub _generate_method {
40 my $self = shift;
41
42 my $inv = '$self';
43
44 my $slot_access = $self->_inline_get($inv);
45
46 my $code = 'sub {';
47
48 $code .= "\n" . $self->_inline_pre_body(@_);
49 $code .= "\n" . 'my $self = shift;';
50
51 $code .= "\n" . $self->_inline_curried_arguments;
52
53 $code .= "\n" . 'if ( @_ == 1 || @_ == 2 ) {';
54
55 $code .= $self->_reader_core( $inv, $slot_access );
56
57 $code .= "\n" . '} elsif ( @_ == 3 ) {';
58
59 $code .= $self->_writer_core( $inv, $slot_access );
60
61 $code .= "\n" . $self->_inline_post_body(@_);
62
63 $code .= "\n" . '} else {';
64
65 $code .= "\n" . $self->_inline_check_argument_count;
66
67 $code .= "\n" . '}';
68 $code .= "\n" . '}';
69
70 return $code;
71}
72
73sub _minimum_arguments {1}
74sub _maximum_arguments {3}
75
76sub _inline_process_arguments {
77 my ( $self, $inv, $slot_access ) = @_;
78
79 return
80 'my $offset = shift;' . "\n"
81 . "my \$length = \@_ ? shift : length $slot_access;" . "\n"
82 . 'my $replacement = shift;';
83}
84
85sub _inline_check_arguments {
86 my ( $self, $for_writer ) = @_;
87
88 my $code
89 = $self->_inline_throw_error(
90 q{'The first argument passed to substr must be an integer'})
91 . q{ unless $offset =~ /^-?\\d+$/;} . "\n"
92 . $self->_inline_throw_error(
93 q{'The second argument passed to substr must be an integer'})
94 . q{ unless $length =~ /^-?\\d+$/;};
95
96 if ($for_writer) {
97 $code
98 .= "\n"
99 . $self->_inline_throw_error(
100 q{'The third argument passed to substr must be a string'})
101 . q{ unless Moose::Util::_STRINGLIKE0($replacement);};
102 }
103
104 return $code;
105}
106
107sub _potential_value {
108 my ( $self, $slot_access ) = @_;
109
110 return
111 "( do { my \$potential = $slot_access; \@return = substr \$potential, \$offset, \$length, \$replacement; \$potential; } )";
112}
113
114sub _inline_optimized_set_new_value {
115 my ( $self, $inv, $new, $slot_access ) = @_;
116
117 return "\@return = substr $slot_access, \$offset, \$length, \$replacement";
118}
119
120sub _return_value {
121 my ( $self, $slot_access, $for_writer ) = @_;
122
123 return '$return[0]' if $for_writer;
124
125 return "substr $slot_access, \$offset, \$length";
126}
127
1283122µs21.55ms
# spent 800µs (49+751) within Moose::Meta::Method::Accessor::Native::String::substr::BEGIN@128 which was called: # once (49µs+751µs) by Moose::Meta::Attribute::Native::Trait::String::BEGIN@17 at line 128
no Moose::Role;
129
130152µs1;