Filename | /usr/local/lib/perl/5.18.2/HTTP/Parser/XS.pm |
Statements | Executed 23 statements in 430µs |
Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
---|---|---|---|---|---|
100001 | 1 | 1 | 1.57s | 1.57s | parse_http_request (xsub) | HTTP::Parser::XS::
1 | 1 | 1 | 12µs | 56µs | BEGIN@16 | HTTP::Parser::XS::
1 | 1 | 1 | 8µs | 16µs | BEGIN@3 | HTTP::Parser::XS::
1 | 1 | 1 | 7µs | 70µs | BEGIN@6 | HTTP::Parser::XS::
1 | 1 | 1 | 6µs | 8µs | BEGIN@4 | HTTP::Parser::XS::
1 | 1 | 1 | 200ns | 200ns | CORE:match (opcode) | HTTP::Parser::XS::
Line | State ments |
Time on line |
Calls | Time in subs |
Code |
---|---|---|---|---|---|
1 | package HTTP::Parser::XS; | ||||
2 | |||||
3 | 2 | 18µs | 2 | 25µs | # spent 16µs (8+8) within HTTP::Parser::XS::BEGIN@3 which was called:
# once (8µs+8µs) by Plack::HTTPParser::try {...} at line 3 # spent 16µs making 1 call to HTTP::Parser::XS::BEGIN@3
# spent 8µs making 1 call to strict::import |
4 | 2 | 23µs | 2 | 11µs | # spent 8µs (6+3) within HTTP::Parser::XS::BEGIN@4 which was called:
# once (6µs+3µs) by Plack::HTTPParser::try {...} at line 4 # spent 8µs making 1 call to HTTP::Parser::XS::BEGIN@4
# spent 3µs making 1 call to warnings::import |
5 | |||||
6 | 2 | 76µs | 2 | 134µs | # spent 70µs (7+64) within HTTP::Parser::XS::BEGIN@6 which was called:
# once (7µs+64µs) by Plack::HTTPParser::try {...} at line 6 # spent 70µs making 1 call to HTTP::Parser::XS::BEGIN@6
# spent 64µs making 1 call to base::import |
7 | |||||
8 | 1 | 2µs | our %EXPORT_TAGS = ( | ||
9 | 'all' => [ qw/parse_http_request parse_http_response | ||||
10 | HEADERS_NONE HEADERS_AS_HASHREF HEADERS_AS_ARRAYREF/ ], | ||||
11 | ); | ||||
12 | 1 | 2µs | our @EXPORT_OK = @{$EXPORT_TAGS{all}}; | ||
13 | 1 | 200ns | our @EXPORT = (); | ||
14 | |||||
15 | # header format for parse_http_response() | ||||
16 | # spent 56µs (12+45) within HTTP::Parser::XS::BEGIN@16 which was called:
# once (12µs+45µs) by Plack::HTTPParser::try {...} at line 20 | ||||
17 | 1 | 9µs | 1 | 45µs | HEADERS_NONE => 0, # don't parse headers. It's fastest. if you want only special headers, also fastest. # spent 45µs making 1 call to constant::import |
18 | HEADERS_AS_HASHREF => 1, # HTTP::Headers compatible HashRef, { header_name => "header_value" or ["val1", "val2"] } | ||||
19 | HEADERS_AS_ARRAYREF =>2, # Ordered ArrayRef : [ name, value, name2, value2 ... ] | ||||
20 | 1 | 126µs | 1 | 56µs | }; # spent 56µs making 1 call to HTTP::Parser::XS::BEGIN@16 |
21 | |||||
22 | 1 | 300ns | our $VERSION = '0.16'; | ||
23 | |||||
24 | 1 | 100ns | our $BACKEND; | ||
25 | |||||
26 | 1 | 9µs | 1 | 2µs | if (not __PACKAGE__->can('parse_http_response')) { # spent 2µs making 1 call to UNIVERSAL::can |
27 | 1 | 800ns | $BACKEND = $ENV{PERL_HTTP_PARSER_XS} || ($ENV{PERL_ONLY} ? 'pp' : ''); | ||
28 | 1 | 4µs | 1 | 200ns | if ($BACKEND !~ /\b pp \b/xms) { # spent 200ns making 1 call to HTTP::Parser::XS::CORE:match |
29 | 1 | 300ns | eval { | ||
30 | 1 | 700ns | require XSLoader; | ||
31 | 1 | 144µs | 1 | 139µs | XSLoader::load(__PACKAGE__, $VERSION); # spent 139µs making 1 call to XSLoader::load |
32 | 1 | 600ns | $BACKEND = 'xs'; | ||
33 | }; | ||||
34 | 1 | 200ns | die $@ if $@ && $BACKEND =~ /\bxs\b/; | ||
35 | } | ||||
36 | 1 | 5µs | 1 | 1µs | if (not __PACKAGE__->can('parse_http_response')) { # spent 1µs making 1 call to UNIVERSAL::can |
37 | require HTTP::Parser::XS::PP; | ||||
38 | $BACKEND = 'pp'; | ||||
39 | } | ||||
40 | } | ||||
41 | |||||
42 | 1 | 10µs | 1; | ||
43 | __END__ | ||||
# spent 200ns within HTTP::Parser::XS::CORE:match which was called:
# once (200ns+0s) by Plack::HTTPParser::try {...} at line 28 | |||||
# spent 1.57s within HTTP::Parser::XS::parse_http_request which was called 100001 times, avg 16µs/call:
# 100001 times (1.57s+0s) by HTTP::Server::PSGI::handle_connection at line 147 of HTTP/Server/PSGI.pm, avg 16µs/call |