← 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/MediaTypeList.pm
StatementsExecuted 1400028 statements in 7.22s
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
100001112.48s22.4sHTTP::Headers::ActionPack::MediaTypeList::::add_header_valueHTTP::Headers::ActionPack::MediaTypeList::add_header_value
100001112.45s2.73sHTTP::Headers::ActionPack::MediaTypeList::::iterableHTTP::Headers::ActionPack::MediaTypeList::iterable
100001111.13s14.6sHTTP::Headers::ActionPack::MediaTypeList::::addHTTP::Headers::ActionPack::MediaTypeList::add
10000111884ms1.20sHTTP::Headers::ActionPack::MediaTypeList::::canonicalize_choiceHTTP::Headers::ActionPack::MediaTypeList::canonicalize_choice
10000111429ms429msHTTP::Headers::ActionPack::MediaTypeList::::BUILDHTTP::Headers::ActionPack::MediaTypeList::BUILD
10000111112ms112msHTTP::Headers::ActionPack::MediaTypeList::::CORE:sortHTTP::Headers::ActionPack::MediaTypeList::CORE:sort (opcode)
1111.15ms18.5msHTTP::Headers::ActionPack::MediaTypeList::::BEGIN@15HTTP::Headers::ActionPack::MediaTypeList::BEGIN@15
11127µs27µsHTTP::Headers::ActionPack::MediaTypeList::::BEGIN@2HTTP::Headers::ActionPack::MediaTypeList::BEGIN@2
11121µs86µsHTTP::Headers::ActionPack::MediaTypeList::::BEGIN@10HTTP::Headers::ActionPack::MediaTypeList::BEGIN@10
11118µs34µsHTTP::Headers::ActionPack::MediaTypeList::::BEGIN@11HTTP::Headers::ActionPack::MediaTypeList::BEGIN@11
11114µs2.60msHTTP::Headers::ActionPack::MediaTypeList::::BEGIN@17HTTP::Headers::ActionPack::MediaTypeList::BEGIN@17
11114µs84µsHTTP::Headers::ActionPack::MediaTypeList::::BEGIN@13HTTP::Headers::ActionPack::MediaTypeList::BEGIN@13
0000s0sHTTP::Headers::ActionPack::MediaTypeList::::as_stringHTTP::Headers::ActionPack::MediaTypeList::as_string
Call graph for these subroutines as a Graphviz dot language file.
Line State
ments
Time
on line
Calls Time
in subs
Code
1package HTTP::Headers::ActionPack::MediaTypeList;
2
# spent 27µs within HTTP::Headers::ActionPack::MediaTypeList::BEGIN@2 which was called: # once (27µs+0s) by Module::Runtime::require_module at line 4
BEGIN {
3118µs $HTTP::Headers::ActionPack::MediaTypeList::AUTHORITY = 'cpan:STEVAN';
4159µs127µs}
# spent 27µs making 1 call to HTTP::Headers::ActionPack::MediaTypeList::BEGIN@2
5{
622µs $HTTP::Headers::ActionPack::MediaTypeList::VERSION = '0.09';
7}
8# ABSTRACT: A Priority List customized for Media Types
9
10250µs2151µs
# spent 86µs (21+65) within HTTP::Headers::ActionPack::MediaTypeList::BEGIN@10 which was called: # once (21µs+65µs) by Module::Runtime::require_module at line 10
use strict;
# spent 86µs making 1 call to HTTP::Headers::ActionPack::MediaTypeList::BEGIN@10 # spent 65µs making 1 call to strict::import
11245µs249µs
# spent 34µs (18+15) within HTTP::Headers::ActionPack::MediaTypeList::BEGIN@11 which was called: # once (18µs+15µs) by Module::Runtime::require_module at line 11
use warnings;
# spent 34µs making 1 call to HTTP::Headers::ActionPack::MediaTypeList::BEGIN@11 # spent 15µs making 1 call to warnings::import
12
13237µs2154µs
# spent 84µs (14+70) within HTTP::Headers::ActionPack::MediaTypeList::BEGIN@13 which was called: # once (14µs+70µs) by Module::Runtime::require_module at line 13
use Scalar::Util qw[ blessed ];
# spent 84µs making 1 call to HTTP::Headers::ActionPack::MediaTypeList::BEGIN@13 # spent 70µs making 1 call to Exporter::import
14
152476µs118.5ms
# spent 18.5ms (1.15+17.4) within HTTP::Headers::ActionPack::MediaTypeList::BEGIN@15 which was called: # once (1.15ms+17.4ms) by Module::Runtime::require_module at line 15
use HTTP::Headers::ActionPack::MediaType;
16
172509µs25.19ms
# spent 2.60ms (14µs+2.59) within HTTP::Headers::ActionPack::MediaTypeList::BEGIN@17 which was called: # once (14µs+2.59ms) by Module::Runtime::require_module at line 17
use parent 'HTTP::Headers::ActionPack::PriorityList';
# spent 2.60ms making 1 call to HTTP::Headers::ActionPack::MediaTypeList::BEGIN@17 # spent 2.59ms making 1 call to parent::import
18
19
# spent 429ms within HTTP::Headers::ActionPack::MediaTypeList::BUILD which was called 100001 times, avg 4µs/call: # 100001 times (429ms+0s) by HTTP::Headers::ActionPack::Core::Base::new at line 18 of HTTP/Headers/ActionPack/Core/Base.pm, avg 4µs/call
sub BUILD {
2010000180.6ms my ($self, @items) = @_;
21100001756ms foreach my $item ( @items ) {
22 $self->add( ref $item eq 'ARRAY' ? @$item : $item )
23 }
24}
25
26
# spent 14.6s (1.13+13.5) within HTTP::Headers::ActionPack::MediaTypeList::add which was called 100001 times, avg 146µs/call: # 100001 times (1.13s+13.5s) by HTTP::Headers::ActionPack::MediaTypeList::add_header_value at line 36, avg 146µs/call
sub add {
2710000147.8ms my $self = shift;
28100001164ms my ($q, $mt) = scalar @_ == 1 ? ((exists $_[0]->params->{'q'} ?$_[0]->params->{'q'} : 1.0), $_[0]) : @_;
29100001825ms10000113.5s $self->SUPER::add( $q, $mt );
# spent 13.5s making 100001 calls to HTTP::Headers::ActionPack::PriorityList::add, avg 135µs/call
30}
31
32
# spent 22.4s (2.48+19.9) within HTTP::Headers::ActionPack::MediaTypeList::add_header_value which was called 100001 times, avg 224µs/call: # 100001 times (2.48s+19.9s) by HTTP::Headers::ActionPack::PriorityList::new_from_string at line 36 of HTTP/Headers/ActionPack/PriorityList.pm, avg 224µs/call
sub add_header_value {
3310000152.6ms my $self = shift;
34100001566ms1000015.04s my $mt = HTTP::Headers::ActionPack::MediaType->new( @{ $_[0] } );
# spent 5.04s making 100001 calls to HTTP::Headers::ActionPack::Core::Base::new, avg 50µs/call
35100001299ms100001280ms my $q = $mt->params->{'q'} || 1.0;
# spent 280ms making 100001 calls to HTTP::Headers::ActionPack::Core::BaseHeaderWithParams::params, avg 3µs/call
36100001777ms10000114.6s $self->add( $q, $mt );
# spent 14.6s making 100001 calls to HTTP::Headers::ActionPack::MediaTypeList::add, avg 146µs/call
37}
38
39sub as_string {
40 my $self = shift;
41 join ', ' => map { $_->[1]->as_string } $self->iterable;
42}
43
44
# spent 2.73s (2.45+280ms) within HTTP::Headers::ActionPack::MediaTypeList::iterable which was called 100001 times, avg 27µs/call: # 100001 times (2.45s+280ms) by PONAPI::Server::_ponapi_check_headers at line 222 of lib/PONAPI/Server.pm, avg 27µs/call
sub iterable {
4510000147.7ms my $self = shift;
46 # From RFC-2616 sec14
47 # Media ranges can be overridden by more specific
48 # media ranges or specific media types. If more
49 # than one media range applies to a given type,
50 # the most specific reference has precedence.
51 sort {
5210000162.9ms if ( $a->[0] == $b->[0] ) {
53 $a->[1]->matches_all
54 ? 1
55 : ($b->[1]->matches_all
56 ? -1
57 : ($a->[1]->minor eq '*'
58 ? 1
59 : ($b->[1]->minor eq '*'
60 ? -1
61 : ($a->[1]->params_are_empty
62 ? 1
63 : ($b->[1]->params_are_empty
64 ? -1
65 : 0)))))
66 }
67 else {
68 $b->[0] <=> $a->[0]
69 }
70 } map {
71 my $q = $_;
72100001459ms10000185.0ms map { [ $q+0, $_ ] } reverse @{ $self->items->{ $q } }
# spent 85.0ms making 100001 calls to HTTP::Headers::ActionPack::PriorityList::items, avg 850ns/call
731000011.46s200002195ms } keys %{ $self->items };
# spent 112ms making 100001 calls to HTTP::Headers::ActionPack::MediaTypeList::CORE:sort, avg 1µs/call # spent 83.9ms making 100001 calls to HTTP::Headers::ActionPack::PriorityList::items, avg 839ns/call
74}
75
76
# spent 1.20s (884ms+317ms) within HTTP::Headers::ActionPack::MediaTypeList::canonicalize_choice which was called 100001 times, avg 12µs/call: # 100001 times (884ms+317ms) by HTTP::Headers::ActionPack::PriorityList::add at line 53 of HTTP/Headers/ActionPack/PriorityList.pm, avg 12µs/call
sub canonicalize_choice {
771000011.62s100001317ms return blessed $_[1]
# spent 317ms making 100001 calls to Scalar::Util::blessed, avg 3µs/call
78 ? $_[1]
79 : HTTP::Headers::ActionPack::MediaType->new( $_[1] );
80}
81
8213µs1;
83
84__END__
 
# spent 112ms within HTTP::Headers::ActionPack::MediaTypeList::CORE:sort which was called 100001 times, avg 1µs/call: # 100001 times (112ms+0s) by HTTP::Headers::ActionPack::MediaTypeList::iterable at line 73, avg 1µs/call
sub HTTP::Headers::ActionPack::MediaTypeList::CORE:sort; # opcode