Profile of lib/PONAPI/Builder/Links.pm

← Index
NYTProf Performance Profile «line view»
For script/ponapi
Run on Wed Feb 10 15:51:26 2016
Reported on Thu Feb 11 09:43:11 2016

Filename | /home/mickey/git_tree/PONAPI/Server/lib/PONAPI/Builder/Links.pm
Statements | Executed 9452068 statements in 16.2s

Subroutines
Calls | P | F | Exclusive Time | Inclusive Time | Subroutine
--- | --- | --- | --- | --- | ---
1091615 | 3 | 3 | 16.2s | 25.2s | PONAPI::Builder::Links::::buildPONAPI::Builder::Links::build
716014 | 3 | 3 | 4.03s | 15.2s | PONAPI::Builder::Links::::add_linkPONAPI::Builder::Links::add_link
529024 | 2 | 1 | 685ms | 685ms | PONAPI::Builder::Links::::__ANON__[lib/PONAPI/Builder/Links.pm:15]PONAPI::Builder::Links::__ANON__[lib/PONAPI/Builder/Links.pm:15]
1 | 1 | 1 | 16µs | 6.70ms | PONAPI::Builder::Links::::BEGIN@4PONAPI::Builder::Links::BEGIN@4
1 | 1 | 1 | 9µs | 72µs | PONAPI::Builder::Links::::BEGIN@52PONAPI::Builder::Links::BEGIN@52
0 | 0 | 0 | 0s | 0s | PONAPI::Builder::Links::::add_linksPONAPI::Builder::Links::add_links

Call graph for these subroutines as a Graphviz dot language file.

Line | State ments | Time on line | Calls | Time in subs | Code
--- | --- | --- | --- | --- | ---
1 |  |  |  |  | # ABSTRACT: document builder - links
2 |  |  |  |  | package PONAPI::Builder::Links;
3 |  |  |  |  |
4 | 2 | 237µs | 2 | 13.4ms | # spent 6.70ms (16µs+6.69) within PONAPI::Builder::Links::BEGIN@4 which was called: # once (16µs+6.69ms) by PONAPI::Builder::Role::HasLinksBuilder::BEGIN@6 at line 4 use Moose; # spent 6.70ms making 1 call to PONAPI::Builder::Links::BEGIN@4 # spent 6.69ms making 1 call to Moose::import
5 |  |  |  |  |
6 | 1 | 3µs | 1 | 7.65ms | with 'PONAPI::Builder', # spent 7.65ms making 1 call to Moose::with
7 |  |  |  |  | 'PONAPI::Builder::Role::HasMeta';
8 |  |  |  |  |
9 |  |  |  |  | has _links => (
10 |  |  |  |  | init_arg => undef,
11 |  |  |  |  | traits => [ 'Hash' ],
12 |  |  |  |  | is => 'ro',
13 |  |  |  |  | isa => 'HashRef',
14 |  |  |  |  | lazy => 1,
15 | 529024 | 2.75s |  |  | # spent 685ms within PONAPI::Builder::Links::__ANON__[lib/PONAPI/Builder/Links.pm:15] which was called 529024 times, avg 1µs/call: # 429023 times (594ms+0s) by PONAPI::Builder::Links::_add_link at line 24 of (eval 45)[Eval/Closure.pm:144], avg 1µs/call # 100001 times (90.5ms+0s) by PONAPI::Builder::Links::has_link at line 20 of (eval 45)[Eval/Closure.pm:144], avg 905ns/call default => sub { +{} },
16 | 1 | 10µs | 1 | 103ms | handles => { # spent 103ms making 1 call to Moose::has
17 |  |  |  |  | 'has_links' => 'count',
18 |  |  |  |  | 'has_link' => 'exists',
19 |  |  |  |  | 'get_link' => 'get',
20 |  |  |  |  | # private ...
21 |  |  |  |  | '_add_link' => 'set',
22 |  |  |  |  | '_keys_links' => 'keys',
23 |  |  |  |  | }
24 |  |  |  |  | );
25 |  |  |  |  |
26 |  |  |  |  | # spent 15.2s (4.03+11.2) within PONAPI::Builder::Links::add_link which was called 716014 times, avg 21µs/call: # 345766 times (1.85s+4.73s) by PONAPI::Builder::Relationship::_add_relationship_link at line 63 of lib/PONAPI/Builder/Relationship.pm, avg 19µs/call # 270247 times (1.64s+5.59s) by PONAPI::Builder::Resource::add_self_link at line 95 of lib/PONAPI/Builder/Resource.pm, avg 27µs/call # 100001 times (537ms+867ms) by PONAPI::Builder::Document::add_self_link at line 138 of lib/PONAPI/Builder/Document.pm, avg 14µs/call sub add_link {
27 | 716014 | 350ms |  |  | my ( $self, $rel, $url ) = @_;
28 | 716014 | 1.01s | 716014 | 11.2s | $self->_add_link( $rel => $url ); # spent 11.2s making 716014 calls to PONAPI::Builder::Links::_add_link, avg 16µs/call
29 | 716014 | 2.49s |  |  | return $self;
30 |  |  |  |  | }
31 |  |  |  |  |
32 |  |  |  |  | sub add_links {
33 |  |  |  |  | my ( $self, %links ) = @_;
34 |  |  |  |  | $self->add_link( $_, $links{ $_ } ) foreach keys %links;
35 |  |  |  |  | return $self;
36 |  |  |  |  | }
37 |  |  |  |  |
38 |  |  |  |  | # spent 25.2s (16.2+9.07) within PONAPI::Builder::Links::build which was called 1091615 times, avg 23µs/call: # 607534 times (8.68s+5.13s) by PONAPI::Builder::Resource::build at line 106 of lib/PONAPI/Builder/Resource.pm, avg 23µs/call # 384080 times (5.89s+2.96s) by PONAPI::Builder::Relationship::build at line 89 of lib/PONAPI/Builder/Relationship.pm, avg 23µs/call # 100001 times (1.59s+984ms) by PONAPI::Builder::Document::build at line 149 of lib/PONAPI/Builder/Document.pm, avg 26µs/call sub build {
39 | 1091615 | 218ms |  |  | my $self = $_[0];
40 | 1091615 | 313ms |  |  | my $result = {};
41 |  |  |  |  |
42 | 1091615 | 1.73s | 1091615 | 2.76s | foreach my $key ( $self->_keys_links ) { # spent 2.76s making 1091615 calls to PONAPI::Builder::Links::_keys_links, avg 3µs/call
43 | 1316919 | 2.68s | 1316919 | 4.40s | $result->{ $key } = $self->get_link( $key ); # spent 4.40s making 1316919 calls to PONAPI::Builder::Links::get_link, avg 3µs/call
44 |  |  |  |  | }
45 |  |  |  |  |
46 | 1091615 | 1.18s | 1091615 | 1.91s | $result->{meta} = $self->_meta if $self->has_meta; # spent 1.91s making 1091615 calls to PONAPI::Builder::Links::has_meta, avg 2µs/call
47 |  |  |  |  |
48 | 1091615 | 3.47s |  |  | return $result;
49 |  |  |  |  | }
50 |  |  |  |  |
51 | 1 | 4µs | 2 | 2.50ms | __PACKAGE__->meta->make_immutable; # spent 2.48ms making 1 call to Class::MOP::Class::make_immutable # spent 16µs making 1 call to PONAPI::Builder::Links::meta
52 | 3 | 62µs | 2 | 135µs | # spent 72µs (9+63) within PONAPI::Builder::Links::BEGIN@52 which was called: # once (9µs+63µs) by PONAPI::Builder::Role::HasLinksBuilder::BEGIN@6 at line 52 no Moose; 1; # spent 72µs making 1 call to PONAPI::Builder::Links::BEGIN@52 # spent 63µs making 1 call to Moose::unimport
53 |  |  |  |  |
54 |  |  |  |  | __END__