← Index
NYTProf Performance Profile   « block view • line view • sub view »
For 05.Domain_and_Item.t
  Run on Tue May 4 17:21:41 2010
Reported on Tue May 4 17:22:56 2010

File /usr/local/lib/perl5/site_perl/5.10.1/darwin-2level/Class/MOP/Method/Generated.pm
Statements Executed 4670
Statement Execution Time 63.0ms
Subroutines — ordered by exclusive time
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
2367327.5ms27.9msClass::MOP::Method::Generated::::_eval_closureClass::MOP::Method::Generated::_eval_closure
101331.17ms18.0msClass::MOP::Method::Generated::::_compile_codeClass::MOP::Method::Generated::_compile_code
101111.08ms1.22msClass::MOP::Method::Generated::::_add_line_directiveClass::MOP::Method::Generated::_add_line_directive
111641µs917µsClass::MOP::Method::Generated::::BEGIN@15Class::MOP::Method::Generated::BEGIN@15
30722351µs351µsClass::MOP::Method::Generated::::is_inlineClass::MOP::Method::Generated::is_inline
10111138µs138µsClass::MOP::Method::Generated::::definition_contextClass::MOP::Method::Generated::definition_context
11119µs21µsClass::MOP::Method::Generated::::BEGIN@4Class::MOP::Method::Generated::BEGIN@4
1117µs16µsClass::MOP::Method::Generated::::BEGIN@5Class::MOP::Method::Generated::BEGIN@5
1117µs46µsClass::MOP::Method::Generated::::BEGIN@13Class::MOP::Method::Generated::BEGIN@13
1116µs29µsClass::MOP::Method::Generated::::BEGIN@7Class::MOP::Method::Generated::BEGIN@7
0000s0sClass::MOP::Method::Generated::::_initialize_bodyClass::MOP::Method::Generated::_initialize_body
0000s0sClass::MOP::Method::Generated::::newClass::MOP::Method::Generated::new
Call graph for these subroutines as a Graphviz dot language file.
Line State
ments
Time
on line
Calls Time
in subs
Code
1
2package Class::MOP::Method::Generated;
3
4322µs224µs
# spent 21µs (19+3) within Class::MOP::Method::Generated::BEGIN@4 which was called # once (19µs+3µs) by base::import at line 4
use strict;
# spent 21µs making 1 call to Class::MOP::Method::Generated::BEGIN@4 # spent 3µs making 1 call to strict::import
5320µs224µs
# spent 16µs (7+9) within Class::MOP::Method::Generated::BEGIN@5 which was called # once (7µs+9µs) by base::import at line 5
use warnings;
# spent 16µs making 1 call to Class::MOP::Method::Generated::BEGIN@5 # spent 9µs making 1 call to warnings::import
6
7360µs252µs
# spent 29µs (6+23) within Class::MOP::Method::Generated::BEGIN@7 which was called # once (6µs+23µs) by base::import at line 7
use Carp 'confess';
# spent 29µs making 1 call to Class::MOP::Method::Generated::BEGIN@7 # spent 23µs making 1 call to Exporter::import
8
91600nsour $VERSION = '0.98';
10113µs$VERSION = eval $VERSION;
111300nsour $AUTHORITY = 'cpan:STEVAN';
12
13339µs246µs
# spent 46µs (7+40) within Class::MOP::Method::Generated::BEGIN@13 which was called # once (7µs+40µs) by base::import at line 13
use base 'Class::MOP::Method';
# spent 46µs making 1 call to Class::MOP::Method::Generated::BEGIN@13 # spent 40µs making 1 call to base::import, recursion: max depth 1, time 40µs
14
153395µs2976µs
# spent 917µs (641+275) within Class::MOP::Method::Generated::BEGIN@15 which was called # once (641µs+275µs) by base::import at line 15
use constant _PRINT_SOURCE => $ENV{MOP_PRINT_SOURCE} ? 1 : 0;
# spent 917µs making 1 call to Class::MOP::Method::Generated::BEGIN@15 # spent 59µs making 1 call to constant::import
16
17## accessors
18
19sub new {
20 confess __PACKAGE__ . " is an abstract base class, you must provide a constructor.";
21}
22
23307543µs
# spent 351µs within Class::MOP::Method::Generated::is_inline which was called 307 times, avg 1µs/call: # 276 times (315µs+0s) by Class::MOP::Method::Accessor::_initialize_body at line 80 of Class/MOP/Method/Accessor.pm, avg 1µs/call # 31 times (36µs+0s) by Class::MOP::Method::Constructor::_initialize_body at line 91 of Class/MOP/Method/Constructor.pm, avg 1µs/call
sub is_inline { $_[0]{is_inline} }
24
25101237µs
# spent 138µs within Class::MOP::Method::Generated::definition_context which was called 101 times, avg 1µs/call: # 101 times (138µs+0s) by Class::MOP::Method::Generated::_add_line_directive at line 66, avg 1µs/call
sub definition_context { $_[0]{definition_context} }
26
27sub _initialize_body {
28 confess "No body to initialize, " . __PACKAGE__ . " is an abstract base class";
29}
30
31
# spent 27.9ms (27.5+358µs) within Class::MOP::Method::Generated::_eval_closure which was called 236 times, avg 118µs/call: # 101 times (15.3ms+325µs) by Class::MOP::Method::Generated::_compile_code at line 91, avg 154µs/call # 52 times (2.98ms+0s) by Class::MOP::Method::Accessor::_generate_reader_method_inline at line 157 of Class/MOP/Method/Accessor.pm, avg 57µs/call # 31 times (6.58ms+32µs) by Class::MOP::Method::Constructor::_generate_constructor_method_inline at line 121 of Class/MOP/Method/Constructor.pm, avg 213µs/call # 31 times (1.49ms+0s) by Class::MOP::Method::Accessor::_generate_predicate_method_inline at line 192 of Class/MOP/Method/Accessor.pm, avg 48µs/call # 15 times (912µs+0s) by Class::MOP::Method::Accessor::_generate_accessor_method_inline at line 138 of Class/MOP/Method/Accessor.pm, avg 61µs/call # 3 times (160µs+0s) by Class::MOP::Method::Accessor::_generate_writer_method_inline at line 175 of Class/MOP/Method/Accessor.pm, avg 53µs/call # 3 times (155µs+0s) by Class::MOP::Method::Accessor::_generate_clearer_method_inline at line 209 of Class/MOP/Method/Accessor.pm, avg 52µs/call
sub _eval_closure {
32 # my ($self, $captures, $sub_body) = @_;
3323654µs my $__captures = $_[1];
34
3523627µs my $code;
36
37236105µs my $e = do {
3823634µs local $@;
39236476µs local $SIG{__DIE__};
40401945µs401358µs my $source = join
# spent 358µs making 401 calls to Class::MOP::Method::Generated::CORE:match, avg 892ns/call
41 "\n", (
42 map {
43236711µs /^([\@\%\$])/
44 or die "capture key should start with \@, \% or \$: $_";
45401400µs q[my ]
46 . $_ . q[ = ]
47 . $1
48 . q[{$__captures->{']
49 . $_ . q['}};];
50 } keys %$__captures
51 ),
52 $_[2];
532361µs print STDERR "\n", $_[0]->name, ":\n", $source, "\n" if _PRINT_SOURCE;
5423655.8ms4926.75ms $code = eval $source;
# spent 6.00ms making 13 calls to Moose::Meta::Class::new_object, avg 462µs/call # spent 139µs making 84 calls to Class::MOP::__ANON__[Class/MOP.pm:494], avg 2µs/call # spent 125µs making 66 calls to Moose::Meta::TypeConstraint::__ANON__[Moose/Meta/TypeConstraint.pm:30], avg 2µs/call # spent 81µs making 13 calls to Class::MOP::Class::initialize, avg 6µs/call # spent 66µs making 66 calls to Moose::Meta::Role::__ANON__[Moose/Meta/Role.pm:256], avg 1µs/call # spent 59µs making 44 calls to Moose::Meta::Role::__ANON__[Moose/Meta/Role.pm:83], avg 1µs/call # spent 49µs making 26 calls to Moose::Meta::Role::Application::__ANON__[Moose/Meta/Role/Application.pm:14], avg 2µs/call # spent 47µs making 26 calls to Moose::Meta::Role::Application::__ANON__[Moose/Meta/Role/Application.pm:20], avg 2µs/call # spent 32µs making 22 calls to Moose::Meta::Role::__ANON__[Moose/Meta/Role.pm:301], avg 1µs/call # spent 27µs making 22 calls to Moose::Meta::Role::__ANON__[Moose/Meta/Role.pm:352], avg 1µs/call # spent 26µs making 22 calls to Class::MOP::__ANON__[Class/MOP.pm:286], avg 1µs/call # spent 26µs making 22 calls to Class::MOP::__ANON__[Class/MOP.pm:176], avg 1µs/call # spent 25µs making 22 calls to Class::MOP::__ANON__[Class/MOP.pm:260], avg 1µs/call # spent 24µs making 22 calls to Class::MOP::__ANON__[Class/MOP.pm:305], avg 1µs/call # spent 22µs making 22 calls to Class::MOP::__ANON__[Class/MOP.pm:218], avg 1µs/call
55236404µs $@;
56 };
57
58236908µs return ( $code, $e );
59}
60
61
# spent 1.22ms (1.08+138µs) within Class::MOP::Method::Generated::_add_line_directive which was called 101 times, avg 12µs/call: # 101 times (1.08ms+138µs) by Class::MOP::Method::Generated::_compile_code at line 89, avg 12µs/call
sub _add_line_directive {
62101132µs my ( $self, %args ) = @_;
63
6410123µs my ( $line, $file );
65
66101208µs101138µs if ( my $ctx = ( $args{context} || $self->definition_context ) ) {
# spent 138µs making 101 calls to Class::MOP::Method::Generated::definition_context, avg 1µs/call
677131µs $line = $ctx->{line};
687187µs if ( my $desc = $ctx->{description} ) {
69 $file = "$desc defined at $ctx->{file}";
70 } else {
71 $file = $ctx->{file};
72 }
73 } else {
743018µs ( $line, $file ) = ( 0, "generated method (unknown origin)" );
75 }
76
7710145µs my $code = $args{code};
78
79 # if it's an array of lines, join it up
80 # don't use newlines so that the definition context is more meaningful
8110115µs $code = join(@$code, ' ') if ref $code;
82
83101427µs return qq{#line $line "$file"\n} . $code;
84}
85
86
# spent 18.0ms (1.17+16.8) within Class::MOP::Method::Generated::_compile_code which was called 101 times, avg 178µs/call: # 89 times (1.01ms+14.3ms) by Moose::Meta::Method::Accessor::_eval_code at line 36 of Moose/Meta/Method/Accessor.pm, avg 172µs/call # 6 times (94µs+2.26ms) by Moose::Meta::Method::Constructor::_initialize_body at line 96 of Moose/Meta/Method/Constructor.pm, avg 392µs/call # 6 times (64µs+275µs) by Moose::Meta::Method::Destructor::_initialize_body at line 108 of Moose/Meta/Method/Destructor.pm, avg 57µs/call
sub _compile_code {
87101184µs my ( $self, %args ) = @_;
88
89101256µs1011.22ms my $code = $self->_add_line_directive(%args);
# spent 1.22ms making 101 calls to Class::MOP::Method::Generated::_add_line_directive, avg 12µs/call
90
91101439µs10115.6ms return $self->_eval_closure($args{environment}, $code);
# spent 15.6ms making 101 calls to Class::MOP::Method::Generated::_eval_closure, avg 154µs/call
92}
93
9414µs1;
95
96__END__
97
98=pod
99
100=head1 NAME
101
102Class::MOP::Method::Generated - Abstract base class for generated methods
103
104=head1 DESCRIPTION
105
106This is a C<Class::MOP::Method> subclass which is subclassed by
107C<Class::MOP::Method::Accessor> and
108C<Class::MOP::Method::Constructor>.
109
110It is not intended to be used directly.
111
112=head1 AUTHORS
113
114Stevan Little E<lt>stevan@iinteractive.comE<gt>
115
116=head1 COPYRIGHT AND LICENSE
117
118Copyright 2006-2010 by Infinity Interactive, Inc.
119
120L<http://www.iinteractive.com>
121
122This library is free software; you can redistribute it and/or modify
123it under the same terms as Perl itself.
124
125=cut
126