Profile of HTTP/Headers/ActionPack/PriorityList.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:12 2016

Filename | /usr/local/share/perl/5.18.2/HTTP/Headers/ActionPack/PriorityList.pm
Statements | Executed 1800030 statements in 9.01s

Subroutines
Calls | P | F | Exclusive Time | Inclusive Time | Subroutine
--- | --- | --- | --- | --- | ---
100001 | 1 | 1 | 5.30s | 13.5s | HTTP::Headers::ActionPack::PriorityList::::addHTTP::Headers::ActionPack::PriorityList::add
100001 | 1 | 1 | 2.53s | 33.2s | HTTP::Headers::ActionPack::PriorityList::::new_from_stringHTTP::Headers::ActionPack::PriorityList::new_from_string
100001 | 1 | 1 | 568ms | 568ms | HTTP::Headers::ActionPack::PriorityList::::BUILDARGSHTTP::Headers::ActionPack::PriorityList::BUILDARGS
500005 | 4 | 2 | 529ms | 529ms | HTTP::Headers::ActionPack::PriorityList::::itemsHTTP::Headers::ActionPack::PriorityList::items
100001 | 1 | 1 | 241ms | 241ms | HTTP::Headers::ActionPack::PriorityList::::indexHTTP::Headers::ActionPack::PriorityList::index
1 | 1 | 1 | 14µs | 29µs | HTTP::Headers::ActionPack::PriorityList::::BEGIN@10HTTP::Headers::ActionPack::PriorityList::BEGIN@10
1 | 1 | 1 | 12µs | 837µs | HTTP::Headers::ActionPack::PriorityList::::BEGIN@18HTTP::Headers::ActionPack::PriorityList::BEGIN@18
1 | 1 | 1 | 10µs | 294µs | HTTP::Headers::ActionPack::PriorityList::::BEGIN@13HTTP::Headers::ActionPack::PriorityList::BEGIN@13
1 | 1 | 1 | 10µs | 15µs | HTTP::Headers::ActionPack::PriorityList::::BEGIN@11HTTP::Headers::ActionPack::PriorityList::BEGIN@11
1 | 1 | 1 | 10µs | 10µs | HTTP::Headers::ActionPack::PriorityList::::BEGIN@2HTTP::Headers::ActionPack::PriorityList::BEGIN@2
0 | 0 | 0 | 0s | 0s | HTTP::Headers::ActionPack::PriorityList::::BUILDHTTP::Headers::ActionPack::PriorityList::BUILD
0 | 0 | 0 | 0s | 0s | HTTP::Headers::ActionPack::PriorityList::::add_header_valueHTTP::Headers::ActionPack::PriorityList::add_header_value
0 | 0 | 0 | 0s | 0s | HTTP::Headers::ActionPack::PriorityList::::as_stringHTTP::Headers::ActionPack::PriorityList::as_string
0 | 0 | 0 | 0s | 0s | HTTP::Headers::ActionPack::PriorityList::::canonicalize_choiceHTTP::Headers::ActionPack::PriorityList::canonicalize_choice
0 | 0 | 0 | 0s | 0s | HTTP::Headers::ActionPack::PriorityList::::getHTTP::Headers::ActionPack::PriorityList::get
0 | 0 | 0 | 0s | 0s | HTTP::Headers::ActionPack::PriorityList::::iterableHTTP::Headers::ActionPack::PriorityList::iterable
0 | 0 | 0 | 0s | 0s | HTTP::Headers::ActionPack::PriorityList::::priority_ofHTTP::Headers::ActionPack::PriorityList::priority_of

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

Line | State ments | Time on line | Calls | Time in subs | Code
--- | --- | --- | --- | --- | ---
1 |  |  |  |  | package HTTP::Headers::ActionPack::PriorityList;
2 |  |  |  |  | # spent 10µs within HTTP::Headers::ActionPack::PriorityList::BEGIN@2 which was called: # once (10µs+0s) by parent::import at line 4 BEGIN {
3 | 1 | 6µs |  |  | $HTTP::Headers::ActionPack::PriorityList::AUTHORITY = 'cpan:STEVAN';
4 | 1 | 44µs | 1 | 10µs | } # spent 10µs making 1 call to HTTP::Headers::ActionPack::PriorityList::BEGIN@2
5 |  |  |  |  | {
6 | 2 | 3µs |  |  | $HTTP::Headers::ActionPack::PriorityList::VERSION = '0.09';
7 |  |  |  |  | }
8 |  |  |  |  | # ABSTRACT: A Priority List
9 |  |  |  |  |
10 | 2 | 31µs | 2 | 44µs | # spent 29µs (14+15) within HTTP::Headers::ActionPack::PriorityList::BEGIN@10 which was called: # once (14µs+15µs) by parent::import at line 10 use strict; # spent 29µs making 1 call to HTTP::Headers::ActionPack::PriorityList::BEGIN@10 # spent 15µs making 1 call to strict::import
11 | 2 | 40µs | 2 | 20µs | # spent 15µs (10+5) within HTTP::Headers::ActionPack::PriorityList::BEGIN@11 which was called: # once (10µs+5µs) by parent::import at line 11 use warnings; # spent 15µs making 1 call to HTTP::Headers::ActionPack::PriorityList::BEGIN@11 # spent 5µs making 1 call to warnings::import
12 |  |  |  |  |
13 | 1 | 5µs | 1 | 284µs | # spent 294µs (10+284) within HTTP::Headers::ActionPack::PriorityList::BEGIN@13 which was called: # once (10µs+284µs) by parent::import at line 16 use HTTP::Headers::ActionPack::Util qw[ # spent 284µs making 1 call to Sub::Exporter::__ANON__[Sub/Exporter.pm:337]
14 |  |  |  |  | split_header_words
15 |  |  |  |  | join_header_words
16 | 1 | 34µs | 1 | 294µs | ]; # spent 294µs making 1 call to HTTP::Headers::ActionPack::PriorityList::BEGIN@13
17 |  |  |  |  |
18 | 2 | 1.13ms | 2 | 837µs | # spent 837µs (12+825) within HTTP::Headers::ActionPack::PriorityList::BEGIN@18 which was called: # once (12µs+825µs) by parent::import at line 18 use parent 'HTTP::Headers::ActionPack::Core::BaseHeaderList'; # spent 837µs making 1 call to HTTP::Headers::ActionPack::PriorityList::BEGIN@18 # spent 825µs making 1 call to parent::import, recursion: max depth 1, sum of overlapping time 825µs
19 |  |  |  |  |
20 | 100001 | 896ms |  |  | # spent 568ms within HTTP::Headers::ActionPack::PriorityList::BUILDARGS which was called 100001 times, avg 6µs/call: # 100001 times (568ms+0s) by HTTP::Headers::ActionPack::Core::Base::new at line 17 of HTTP/Headers/ActionPack/Core/Base.pm, avg 6µs/call sub BUILDARGS { +{ 'index' => {}, 'items' => {} } }
21 |  |  |  |  |
22 |  |  |  |  | sub BUILD {
23 |  |  |  |  | my ($self, @items) = @_;
24 |  |  |  |  | foreach my $item ( @items ) {
25 |  |  |  |  | $self->add( @$item )
26 |  |  |  |  | }
27 |  |  |  |  | }
28 |  |  |  |  |
29 | 100001 | 541ms |  |  | # spent 241ms within HTTP::Headers::ActionPack::PriorityList::index which was called 100001 times, avg 2µs/call: # 100001 times (241ms+0s) by HTTP::Headers::ActionPack::PriorityList::add at line 56, avg 2µs/call sub index { (shift)->{'index'} }
30 | 500005 | 2.75s |  |  | # spent 529ms within HTTP::Headers::ActionPack::PriorityList::items which was called 500005 times, avg 1µs/call: # 200002 times (286ms+0s) by HTTP::Headers::ActionPack::PriorityList::add at line 57, avg 1µs/call # 100001 times (85.0ms+0s) by HTTP::Headers::ActionPack::MediaTypeList::iterable at line 72 of HTTP/Headers/ActionPack/MediaTypeList.pm, avg 850ns/call # 100001 times (83.9ms+0s) by HTTP::Headers::ActionPack::MediaTypeList::iterable at line 73 of HTTP/Headers/ActionPack/MediaTypeList.pm, avg 839ns/call # 100001 times (73.5ms+0s) by HTTP::Headers::ActionPack::PriorityList::add at line 58, avg 735ns/call sub items { (shift)->{'items'} }
31 |  |  |  |  |
32 |  |  |  |  | # spent 33.2s (2.53+30.6) within HTTP::Headers::ActionPack::PriorityList::new_from_string which was called 100001 times, avg 332µs/call: # 100001 times (2.53s+30.6s) by HTTP::Headers::ActionPack::create_header at line 100 of HTTP/Headers/ActionPack.pm, avg 332µs/call sub new_from_string {
33 | 100001 | 87.5ms |  |  | my ($class, $header_string) = @_;
34 | 100001 | 391ms | 100001 | 3.84s | my $list = $class->new; # spent 3.84s making 100001 calls to HTTP::Headers::ActionPack::Core::Base::new, avg 38µs/call
35 | 100001 | 479ms | 100001 | 4.38s | foreach my $header ( split_header_words( $header_string ) ) { # spent 4.38s making 100001 calls to HTTP::Headers::ActionPack::Util::split_header_words, avg 44µs/call
36 | 100001 | 368ms | 100001 | 22.4s | $list->add_header_value( $header ); # spent 22.4s making 100001 calls to HTTP::Headers::ActionPack::MediaTypeList::add_header_value, avg 224µs/call
37 |  |  |  |  | }
38 | 100001 | 582ms |  |  | $list;
39 |  |  |  |  | }
40 |  |  |  |  |
41 |  |  |  |  | sub as_string {
42 |  |  |  |  | my $self = shift;
43 |  |  |  |  | join ', ' => map {
44 |  |  |  |  | my ($q, $subject) = @{ $_ };
45 |  |  |  |  | join_header_words( $subject, q => $q );
46 |  |  |  |  | } $self->iterable;
47 |  |  |  |  | }
48 |  |  |  |  |
49 |  |  |  |  | # spent 13.5s (5.30+8.18) within HTTP::Headers::ActionPack::PriorityList::add which was called 100001 times, avg 135µs/call: # 100001 times (5.30s+8.18s) by HTTP::Headers::ActionPack::MediaTypeList::add at line 29 of HTTP/Headers/ActionPack/MediaTypeList.pm, avg 135µs/call sub add {
50 | 100001 | 62.5ms |  |  | my ($self, $q, $choice) = @_;
51 |  |  |  |  | # XXX - should failure to canonicalize be an error? or should
52 |  |  |  |  | # canonicalize_choice itself throw an error on bad values?
53 | 100001 | 744ms | 200002 | 5.01s | $choice = $self->canonicalize_choice($choice) # spent 3.81s making 100001 calls to HTTP::Headers::ActionPack::Core::BaseHeaderType::as_string, avg 38µs/call # spent 1.20s making 100001 calls to HTTP::Headers::ActionPack::MediaTypeList::canonicalize_choice, avg 12µs/call
54 |  |  |  |  | or return;
55 | 100001 | 109ms |  |  | $q += 0; # be sure to numify this
56 | 100001 | 601ms | 200002 | 2.81s | $self->index->{ $choice } = $q; # spent 2.57s making 100001 calls to HTTP::Headers::ActionPack::Core::BaseHeaderType::as_string, avg 26µs/call # spent 241ms making 100001 calls to HTTP::Headers::ActionPack::PriorityList::index, avg 2µs/call
57 | 100001 | 587ms | 200002 | 286ms | $self->items->{ $q } = [] unless exists $self->items->{ $q }; # spent 286ms making 200002 calls to HTTP::Headers::ActionPack::PriorityList::items, avg 1µs/call
58 | 100001 | 810ms | 100001 | 73.5ms | push @{ $self->items->{ $q } } => $choice; # spent 73.5ms making 100001 calls to HTTP::Headers::ActionPack::PriorityList::items, avg 735ns/call
59 |  |  |  |  | }
60 |  |  |  |  |
61 |  |  |  |  | sub add_header_value {
62 |  |  |  |  | my $self = shift;
63 |  |  |  |  | my ($choice, %params) = @{ $_[0] };
64 |  |  |  |  | $self->add( exists $params{'q'} ? $params{'q'} : 1.0, $choice );
65 |  |  |  |  | }
66 |  |  |  |  |
67 |  |  |  |  | sub get {
68 |  |  |  |  | my ($self, $q) = @_;
69 |  |  |  |  | $self->items->{ $q };
70 |  |  |  |  | }
71 |  |  |  |  |
72 |  |  |  |  | sub priority_of {
73 |  |  |  |  | my ($self, $choice) = @_;
74 |  |  |  |  | $choice = $self->canonicalize_choice($choice)
75 |  |  |  |  | or return;
76 |  |  |  |  | $self->index->{ $choice };
77 |  |  |  |  | }
78 |  |  |  |  |
79 |  |  |  |  | sub iterable {
80 |  |  |  |  | my $self = shift;
81 |  |  |  |  | map {
82 |  |  |  |  | my $q = $_;
83 |  |  |  |  | map { [ $q, $_ ] } @{ $self->items->{ $q } }
84 |  |  |  |  | } reverse sort keys %{ $self->items };
85 |  |  |  |  | }
86 |  |  |  |  |
87 |  |  |  |  | sub canonicalize_choice {
88 |  |  |  |  | return $_[1];
89 |  |  |  |  | }
90 |  |  |  |  |
91 | 1 | 4µs |  |  | 1;
92 |  |  |  |  |
93 |  |  |  |  | __END__