Feersum icon indicating copy to clipboard operation
Feersum copied to clipboard

native interface: access specific parts of request

Open vividsnow opened this issue 4 years ago • 1 comments

Hello

This patch gives access to specific parts of feersum connection/request: method uri path query content_length remote_address remote_port headers input. Thus gives performance boost in some scenarios.

Serving native handler via unix-socket behind nginx:

sub ($r) {
    my ($method, $path) = ($r->method, $r->path);
    $r->send_response(200, [qw'content-type text/plain'], ["$method:$path"]);
}

is ~15% faster than psgi handler

sub ($env) {
    my ($method, $path) = @$env{uc'request_method', uc'path_info'};
    [200, [qw'content-type text/plain'], ["$method:$path"]]
}

p.s. there is no performance penalty comparing to current version p.p.s. tested under linux, gcc 10, perl-5.34.0, perl-5.8.9

vividsnow avatar Jul 02 '21 14:07 vividsnow

Hi! Thank you for the contribution. Sorry for the late reply, but I currently do not have the capacity to review & merge this pull request.

If @stash can chime in that would be great, otherwise we may have to wait until someone volunteers time to assume maintainership.

audreyt avatar Jul 23 '21 13:07 audreyt