← Index
NYTProf Performance Profile   « line view »
For /home/ss5/perl5/perlbrew/perls/perl-5.22.0/bin/benchmarkanything-storage
  Run on Mon Jan 29 16:55:34 2018
Reported on Mon Jan 29 16:57:07 2018

Filename/home/ss5/perl5/perlbrew/perls/perl-5.22.0/lib/site_perl/5.22.0/URI/_server.pm
StatementsExecuted 36046 statements in 104ms
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
20021132.9ms72.1msURI::_server::::_uric_escapeURI::_server::_uric_escape
10011118.2ms21.4msURI::_server::::userinfoURI::_server::userinfo
10011116.9ms28.1msURI::_server::::_portURI::_server::_port
20021115.1ms19.0msURI::_server::::_host_escapeURI::_server::_host_escape
10011110.9ms26.3msURI::_server::::hostURI::_server::host
7007517.02ms7.02msURI::_server::::CORE:substURI::_server::CORE:subst (opcode)
6006416.98ms6.98msURI::_server::::CORE:matchURI::_server::CORE:match (opcode)
1001114.85ms32.9msURI::_server::::portURI::_server::port
2003212.57ms2.57msURI::_server::::CORE:regcompURI::_server::CORE:regcomp (opcode)
1118µs9µsURI::_server::::BEGIN@3URI::_server::BEGIN@3
1116µs21µsURI::_server::::BEGIN@8URI::_server::BEGIN@8
1115µs1.55msURI::_server::::BEGIN@6URI::_server::BEGIN@6
1113µs6µsURI::_server::::BEGIN@4URI::_server::BEGIN@4
0000s0sURI::_server::::as_iriURI::_server::as_iri
0000s0sURI::_server::::canonicalURI::_server::canonical
0000s0sURI::_server::::default_portURI::_server::default_port
0000s0sURI::_server::::host_portURI::_server::host_port
0000s0sURI::_server::::ihostURI::_server::ihost
Call graph for these subroutines as a Graphviz dot language file.
Line State
ments
Time
on line
Calls Time
in subs
Code
1package URI::_server;
2
3214µs210µs
# spent 9µs (8+1) within URI::_server::BEGIN@3 which was called: # once (8µs+1µs) by parent::import at line 3
use strict;
# spent 9µs making 1 call to URI::_server::BEGIN@3 # spent 1µs making 1 call to strict::import
4213µs28µs
# spent 6µs (3+3) within URI::_server::BEGIN@4 which was called: # once (3µs+3µs) by parent::import at line 4
use warnings;
# spent 6µs making 1 call to URI::_server::BEGIN@4 # spent 3µs making 1 call to warnings::import
5
6221µs21.55ms
# spent 1.55ms (5µs+1.54) within URI::_server::BEGIN@6 which was called: # once (5µs+1.54ms) by parent::import at line 6
use parent 'URI::_generic';
# spent 1.55ms making 1 call to URI::_server::BEGIN@6 # spent 1.54ms making 1 call to parent::import, recursion: max depth 1, sum of overlapping time 1.54ms
7
82628µs237µs
# spent 21µs (6+16) within URI::_server::BEGIN@8 which was called: # once (6µs+16µs) by parent::import at line 8
use URI::Escape qw(uri_unescape);
# spent 21µs making 1 call to URI::_server::BEGIN@8 # spent 16µs making 1 call to Exporter::import
9
101400nsour $VERSION = "1.69";
11
12
# spent 72.1ms (32.9+39.2) within URI::_server::_uric_escape which was called 2002 times, avg 36µs/call: # 2002 times (32.9ms+39.2ms) by URI::_init at line 81 of URI.pm, avg 36µs/call
sub _uric_escape {
132002719µs my($class, $str) = @_;
1420027.73ms20033.86ms if ($str =~ m,^((?:$URI::scheme_re:)?)//([^/?\#]*)(.*)$,os) {
# spent 3.85ms making 2002 calls to URI::_server::CORE:match, avg 2µs/call # spent 16µs making 1 call to URI::_server::CORE:regcomp
1520023.70ms my($scheme, $host, $rest) = ($1, $2, $3);
16200211.3ms20021.06ms my $ui = $host =~ s/(.*@)// ? $1 : "";
# spent 1.06ms making 2002 calls to URI::_server::CORE:subst, avg 529ns/call
1720026.63ms20023.42ms my $port = $host =~ s/(:\d+)\z// ? $1 : "";
# spent 3.42ms making 2002 calls to URI::_server::CORE:subst, avg 2µs/call
1820023.23ms200219.0ms if (_host_escape($host)) {
# spent 19.0ms making 2002 calls to URI::_server::_host_escape, avg 10µs/call
19 $str = "$scheme//$ui$host$port$rest";
20 }
21 }
2220026.52ms200211.8ms return $class->SUPER::_uric_escape($str);
# spent 11.8ms making 2002 calls to URI::_uric_escape, avg 6µs/call
23}
24
25
# spent 19.0ms (15.1+3.94) within URI::_server::_host_escape which was called 2002 times, avg 10µs/call: # 2002 times (15.1ms+3.94ms) by URI::_server::_uric_escape at line 18, avg 10µs/call
sub _host_escape {
26200219.9ms40043.94ms return unless $_[0] =~ /[^$URI::uric]/;
# spent 2.55ms making 2002 calls to URI::_server::CORE:regcomp, avg 1µs/call # spent 1.39ms making 2002 calls to URI::_server::CORE:match, avg 693ns/call
27 eval {
28 require URI::_idna;
29 $_[0] = URI::_idna::encode($_[0]);
30 };
31 return 0 if $@;
32 return 1;
33}
34
35sub as_iri {
36 my $self = shift;
37 my $str = $self->SUPER::as_iri;
38 if ($str =~ /\bxn--/) {
39 if ($str =~ m,^((?:$URI::scheme_re:)?)//([^/?\#]*)(.*)$,os) {
40 my($scheme, $host, $rest) = ($1, $2, $3);
41 my $ui = $host =~ s/(.*@)// ? $1 : "";
42 my $port = $host =~ s/(:\d+)\z// ? $1 : "";
43 require URI::_idna;
44 $host = URI::_idna::decode($host);
45 $str = "$scheme//$ui$host$port$rest";
46 }
47 }
48 return $str;
49}
50
51sub userinfo
52
# spent 21.4ms (18.2+3.15) within URI::_server::userinfo which was called 1001 times, avg 21µs/call: # 1001 times (18.2ms+3.15ms) by Search::Elasticsearch::Role::Cxn::BUILDARGS at line 75 of Search/Elasticsearch/Role/Cxn.pm, avg 21µs/call
{
531001337µs my $self = shift;
5410011.08ms10012.68ms my $old = $self->authority;
# spent 2.68ms making 1001 calls to URI::_generic::authority, avg 3µs/call
55
561001362µs if (@_) {
57 my $new = $old;
58 $new = "" unless defined $new;
59 $new =~ s/.*@//; # remove old stuff
60 my $ui = shift;
61 if (defined $ui) {
62 $ui =~ s/@/%40/g; # protect @
63 $new = "$ui\@$new";
64 }
65 $self->authority($new);
66 }
67100116.4ms1001472µs return undef if !defined($old) || $old !~ /(.*)@/;
# spent 472µs making 1001 calls to URI::_server::CORE:match, avg 471ns/call
68 return $1;
69}
70
71sub host
72
# spent 26.3ms (10.9+15.4) within URI::_server::host which was called 1001 times, avg 26µs/call: # 1001 times (10.9ms+15.4ms) by Search::Elasticsearch::Role::Cxn::BUILDARGS at line 75 of Search/Elasticsearch/Role/Cxn.pm, avg 26µs/call
{
731001408µs my $self = shift;
7410012.46ms10017.42ms my $old = $self->authority;
# spent 7.42ms making 1001 calls to URI::_generic::authority, avg 7µs/call
751001430µs if (@_) {
76 my $tmp = $old;
77 $tmp = "" unless defined $tmp;
78 my $ui = ($tmp =~ /(.*@)/) ? $1 : "";
79 my $port = ($tmp =~ /(:\d+)$/) ? $1 : "";
80 my $new = shift;
81 $new = "" unless defined $new;
82 if (length $new) {
83 $new =~ s/[@]/%40/g; # protect @
84 if ($new =~ /^[^:]*:\d*\z/ || $new =~ /]:\d*\z/) {
85 $new =~ s/(:\d*)\z// || die "Assert";
86 $port = $1;
87 }
88 $new = "[$new]" if $new =~ /:/ && $new !~ /^\[/; # IPv6 address
89 _host_escape($new);
90 }
91 $self->authority("$ui$new$port");
92 }
931001421µs return undef unless defined $old;
9410011.98ms1001591µs $old =~ s/.*@//;
# spent 591µs making 1001 calls to URI::_server::CORE:subst, avg 590ns/call
9510012.82ms10011.42ms $old =~ s/:\d+$//; # remove the port
# spent 1.42ms making 1001 calls to URI::_server::CORE:subst, avg 1µs/call
9610011.69ms1001528µs $old =~ s{^\[(.*)\]$}{$1}; # remove brackets around IPv6 (RFC 3986 3.2.2)
# spent 528µs making 1001 calls to URI::_server::CORE:subst, avg 528ns/call
9710013.54ms10015.44ms return uri_unescape($old);
# spent 5.44ms making 1001 calls to URI::Escape::uri_unescape, avg 5µs/call
98}
99
100sub ihost
101{
102 my $self = shift;
103 my $old = $self->host(@_);
104 if ($old =~ /(^|\.)xn--/) {
105 require URI::_idna;
106 $old = URI::_idna::decode($old);
107 }
108 return $old;
109}
110
111sub _port
112
# spent 28.1ms (16.9+11.1) within URI::_server::_port which was called 1001 times, avg 28µs/call: # 1001 times (16.9ms+11.1ms) by URI::_server::port at line 129, avg 28µs/call
{
1131001308µs my $self = shift;
11410011.15ms10019.87ms my $old = $self->authority;
# spent 9.87ms making 1001 calls to URI::_generic::authority, avg 10µs/call
1151001370µs if (@_) {
116 my $new = $old;
117 $new =~ s/:\d*$//;
118 my $port = shift;
119 $new .= ":$port" if defined $port;
120 $self->authority($new);
121 }
12210014.62ms10011.28ms return $1 if defined($old) && $old =~ /:(\d*)$/;
# spent 1.28ms making 1001 calls to URI::_server::CORE:match, avg 1µs/call
123 return;
124}
125
126sub port
127
# spent 32.9ms (4.85+28.1) within URI::_server::port which was called 1001 times, avg 33µs/call: # 1001 times (4.85ms+28.1ms) by Search::Elasticsearch::Role::Cxn::BUILDARGS at line 75 of Search/Elasticsearch/Role/Cxn.pm, avg 33µs/call
{
1281001376µs my $self = shift;
12910011.89ms100128.1ms my $port = $self->_port(@_);
# spent 28.1ms making 1001 calls to URI::_server::_port, avg 28µs/call
1301001948µs $port = $self->default_port if !defined($port) || $port eq "";
13110011.94ms $port;
132}
133
134sub host_port
135{
136 my $self = shift;
137 my $old = $self->authority;
138 $self->host(shift) if @_;
139 return undef unless defined $old;
140 $old =~ s/.*@//; # zap userinfo
141 $old =~ s/:$//; # empty port should be treated the same a no port
142 $old .= ":" . $self->port unless $old =~ /:\d+$/;
143 $old;
144}
145
146
147sub default_port { undef }
148
149sub canonical
150{
151 my $self = shift;
152 my $other = $self->SUPER::canonical;
153 my $host = $other->host || "";
154 my $port = $other->_port;
155 my $uc_host = $host =~ /[A-Z]/;
156 my $def_port = defined($port) && ($port eq "" ||
157 $port == $self->default_port);
158 if ($uc_host || $def_port) {
159 $other = $other->clone if $other == $self;
160 $other->host(lc $host) if $uc_host;
161 $other->port(undef) if $def_port;
162 }
163 $other;
164}
165
16612µs1;
 
# spent 6.98ms within URI::_server::CORE:match which was called 6006 times, avg 1µs/call: # 2002 times (3.85ms+0s) by URI::_server::_uric_escape at line 14, avg 2µs/call # 2002 times (1.39ms+0s) by URI::_server::_host_escape at line 26, avg 693ns/call # 1001 times (1.28ms+0s) by URI::_server::_port at line 122, avg 1µs/call # 1001 times (472µs+0s) by URI::_server::userinfo at line 67, avg 471ns/call
sub URI::_server::CORE:match; # opcode
# spent 2.57ms within URI::_server::CORE:regcomp which was called 2003 times, avg 1µs/call: # 2002 times (2.55ms+0s) by URI::_server::_host_escape at line 26, avg 1µs/call # once (16µs+0s) by URI::_server::_uric_escape at line 14
sub URI::_server::CORE:regcomp; # opcode
# spent 7.02ms within URI::_server::CORE:subst which was called 7007 times, avg 1µs/call: # 2002 times (3.42ms+0s) by URI::_server::_uric_escape at line 17, avg 2µs/call # 2002 times (1.06ms+0s) by URI::_server::_uric_escape at line 16, avg 529ns/call # 1001 times (1.42ms+0s) by URI::_server::host at line 95, avg 1µs/call # 1001 times (591µs+0s) by URI::_server::host at line 94, avg 590ns/call # 1001 times (528µs+0s) by URI::_server::host at line 96, avg 528ns/call
sub URI::_server::CORE:subst; # opcode