← 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:09 2016

Filename/usr/local/share/perl/5.18.2/HTTP/Body/UrlEncoded.pm
StatementsExecuted 524 statements in 581µs
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
11112µs24µsHTTP::Body::UrlEncoded::::BEGIN@6HTTP::Body::UrlEncoded::BEGIN@6
1118µs66µsHTTP::Body::UrlEncoded::::BEGIN@7HTTP::Body::UrlEncoded::BEGIN@7
1116µs7µsHTTP::Body::UrlEncoded::::BEGIN@8HTTP::Body::UrlEncoded::BEGIN@8
1112µs2µsHTTP::Body::UrlEncoded::::CORE:qrHTTP::Body::UrlEncoded::CORE:qr (opcode)
0000s0sHTTP::Body::UrlEncoded::::spinHTTP::Body::UrlEncoded::spin
Call graph for these subroutines as a Graphviz dot language file.
Line State
ments
Time
on line
Calls Time
in subs
Code
1package HTTP::Body::UrlEncoded;
2{
32800ns $HTTP::Body::UrlEncoded::VERSION = '1.19';
4}
5
6223µs237µs
# spent 24µs (12+12) within HTTP::Body::UrlEncoded::BEGIN@6 which was called: # once (12µs+12µs) by Plack::Request::BEGIN@10 at line 6
use strict;
# spent 24µs making 1 call to HTTP::Body::UrlEncoded::BEGIN@6 # spent 12µs making 1 call to strict::import
7223µs2123µs
# spent 66µs (8+58) within HTTP::Body::UrlEncoded::BEGIN@7 which was called: # once (8µs+58µs) by Plack::Request::BEGIN@10 at line 7
use base 'HTTP::Body';
# spent 66µs making 1 call to HTTP::Body::UrlEncoded::BEGIN@7 # spent 58µs making 1 call to base::import
82217µs28µs
# spent 7µs (6+1) within HTTP::Body::UrlEncoded::BEGIN@8 which was called: # once (6µs+1µs) by Plack::Request::BEGIN@10 at line 8
use bytes;
# spent 7µs making 1 call to HTTP::Body::UrlEncoded::BEGIN@8 # spent 1µs making 1 call to bytes::import
9
1018µs12µsour $DECODE = qr/%([0-9a-fA-F]{2})/;
# spent 2µs making 1 call to HTTP::Body::UrlEncoded::CORE:qr
11
121100nsour %hex_chr;
13
1411µsfor my $num ( 0 .. 255 ) {
1525660µs my $h = sprintf "%02X", $num;
16256245µs $hex_chr{ lc $h } = $hex_chr{ uc $h } = chr $num;
17}
18
19=head1 NAME
20
21HTTP::Body::UrlEncoded - HTTP Body UrlEncoded Parser
22
23=head1 SYNOPSIS
24
25 use HTTP::Body::UrlEncoded;
26
27=head1 DESCRIPTION
28
29HTTP Body UrlEncoded Parser.
30
31=head1 METHODS
32
33=over 4
34
35=item spin
36
37=cut
38
39sub spin {
40 my $self = shift;
41
42 return unless $self->length == $self->content_length;
43
44 # I tested parsing this using APR::Request, but perl is faster
45 # Pure-Perl 2560/s
46 # APR::Request 2305/s
47
48 # Note: s/// appears faster than tr///
49 $self->{buffer} =~ s/\+/ /g;
50
51 for my $pair ( split( /[&;](?:\s+)?/, $self->{buffer} ) ) {
52
53 my ( $name, $value ) = split( /=/, $pair , 2 );
54
55 next unless defined $name;
56 next unless defined $value;
57
58 $name =~ s/$DECODE/$hex_chr{$1}/gs;
59 $value =~ s/$DECODE/$hex_chr{$1}/gs;
60
61 $self->param( $name, $value );
62 }
63
64 $self->{buffer} = '';
65 $self->{state} = 'done';
66}
67
68=back
69
70=head1 AUTHORS
71
72Christian Hansen, C<ch@ngmedia.com>
73
74Andy Grundman, C<andy@hybridized.org>
75
76=head1 LICENSE
77
78This library is free software . You can redistribute it and/or modify
79it under the same terms as perl itself.
80
81=cut
82
8314µs1;
 
# spent 2µs within HTTP::Body::UrlEncoded::CORE:qr which was called: # once (2µs+0s) by Plack::Request::BEGIN@10 at line 10
sub HTTP::Body::UrlEncoded::CORE:qr; # opcode