← Index
NYTProf Performance Profile   « block view • line view • sub view »
For -e
  Run on Wed Nov 17 21:39:01 2010
Reported on Wed Nov 17 22:04:56 2010

Filename/home/doy/perl5/perlbrew/perls/perl-5.10.1/lib/site_perl/5.10.1/MooseX/Clone.pm
StatementsExecuted 23 statements in 3.90ms
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
1112.83ms84.0msMooseX::Clone::::BEGIN@10MooseX::Clone::BEGIN@10
1111.40ms37.0msMooseX::Clone::::BEGIN@13MooseX::Clone::BEGIN@13
1111.20ms74.4msMooseX::Clone::::BEGIN@11MooseX::Clone::BEGIN@11
1111.19ms35.8msMooseX::Clone::::BEGIN@12MooseX::Clone::BEGIN@12
1111.18ms11.3msMooseX::Clone::::BEGIN@8MooseX::Clone::BEGIN@8
11170µs14.8msMooseX::Clone::::BEGIN@4MooseX::Clone::BEGIN@4
11147µs4.11msMooseX::Clone::::BEGIN@15MooseX::Clone::BEGIN@15
0000s0sMooseX::Clone::::cloneMooseX::Clone::clone
0000s0sMooseX::Clone::::clone_attributeMooseX::Clone::clone_attribute
Call graph for these subroutines as a Graphviz dot language file.
Line State
ments
Time
on line
Calls Time
in subs
Code
1#!/usr/bin/perl
2
3package MooseX::Clone;
43208µs229.6ms
# spent 14.8ms (70µs+14.8) within MooseX::Clone::BEGIN@4 which was called: # once (70µs+14.8ms) by Class::MOP::__ANON__[/home/doy/perl5/perlbrew/perls/perl-5.10.1/lib/site_perl/5.10.1/x86_64-linux/Class/MOP.pm:118] at line 4
use Moose::Role;
# spent 14.8ms making 1 call to MooseX::Clone::BEGIN@4 # spent 14.8ms making 1 call to Moose::Exporter::__ANON__[Moose/Exporter.pm:456]
5
614µsour $VERSION = "0.05";
7
83507µs211.4ms
# spent 11.3ms (1.18+10.1) within MooseX::Clone::BEGIN@8 which was called: # once (1.18ms+10.1ms) by Class::MOP::__ANON__[/home/doy/perl5/perlbrew/perls/perl-5.10.1/lib/site_perl/5.10.1/x86_64-linux/Class/MOP.pm:118] at line 8
use Hash::Util::FieldHash::Compat qw(idhash);
# spent 11.3ms making 1 call to MooseX::Clone::BEGIN@8 # spent 75µs making 1 call to Hash::Util::FieldHash::Compat::import
9
103624µs184.0ms
# spent 84.0ms (2.83+81.1) within MooseX::Clone::BEGIN@10 which was called: # once (2.83ms+81.1ms) by Class::MOP::__ANON__[/home/doy/perl5/perlbrew/perls/perl-5.10.1/lib/site_perl/5.10.1/x86_64-linux/Class/MOP.pm:118] at line 10
use MooseX::Clone::Meta::Attribute::Trait::Clone;
# spent 84.0ms making 1 call to MooseX::Clone::BEGIN@10
113560µs174.4ms
# spent 74.4ms (1.20+73.2) within MooseX::Clone::BEGIN@11 which was called: # once (1.20ms+73.2ms) by Class::MOP::__ANON__[/home/doy/perl5/perlbrew/perls/perl-5.10.1/lib/site_perl/5.10.1/x86_64-linux/Class/MOP.pm:118] at line 11
use MooseX::Clone::Meta::Attribute::Trait::StorableClone;
# spent 74.4ms making 1 call to MooseX::Clone::BEGIN@11
123573µs135.8ms
# spent 35.8ms (1.19+34.6) within MooseX::Clone::BEGIN@12 which was called: # once (1.19ms+34.6ms) by Class::MOP::__ANON__[/home/doy/perl5/perlbrew/perls/perl-5.10.1/lib/site_perl/5.10.1/x86_64-linux/Class/MOP.pm:118] at line 12
use MooseX::Clone::Meta::Attribute::Trait::NoClone;
# spent 35.8ms making 1 call to MooseX::Clone::BEGIN@12
133560µs137.0ms
# spent 37.0ms (1.40+35.6) within MooseX::Clone::BEGIN@13 which was called: # once (1.40ms+35.6ms) by Class::MOP::__ANON__[/home/doy/perl5/perlbrew/perls/perl-5.10.1/lib/site_perl/5.10.1/x86_64-linux/Class/MOP.pm:118] at line 13
use MooseX::Clone::Meta::Attribute::Trait::Copy;
# spent 37.0ms making 1 call to MooseX::Clone::BEGIN@13
14
153818µs28.17ms
# spent 4.11ms (47µs+4.06) within MooseX::Clone::BEGIN@15 which was called: # once (47µs+4.06ms) by Class::MOP::__ANON__[/home/doy/perl5/perlbrew/perls/perl-5.10.1/lib/site_perl/5.10.1/x86_64-linux/Class/MOP.pm:118] at line 15
use namespace::clean -except => 'meta';
# spent 4.11ms making 1 call to MooseX::Clone::BEGIN@15 # spent 4.06ms making 1 call to namespace::clean::import
16
17sub clone {
18 my ( $self, %params ) = @_;
19
20 my $meta = $self->meta;
21
22 my @cloning;
23
24 idhash my %clone_args;
25
26 attr: foreach my $attr ($meta->get_all_attributes()) {
27 # collect all attrs that can be cloned.
28 # if they have args in %params then those are passed to the recursive cloning op
29 if ( $attr->does("MooseX::Clone::Meta::Attribute::Trait::Clone::Base") ) {
30 push @cloning, $attr;
31
32 if ( defined( my $init_arg = $attr->init_arg ) ) {
33 if ( exists $params{$init_arg} ) {
34 $clone_args{$attr} = delete $params{$init_arg};
35 }
36 }
37 }
38 }
39
40 my $clone = $meta->clone_object($self, %params);
41
42 foreach my $attr ( @cloning ) {
43 $clone->clone_attribute(
44 proto => $self,
45 attr => $attr,
46 ( exists $clone_args{$attr} ? ( init_arg => $clone_args{$attr} ) : () ),
47 );
48 }
49
50 return $clone;
51}
52
53sub clone_attribute {
54 my ( $self, %args ) = @_;
55
56 my ( $proto, $attr ) = @args{qw/proto attr/};
57
58 $attr->clone_value( $self, $proto, %args );
59}
60
61112µs__PACKAGE__
62
63135µs113.1ms__END__