File: bench-chunked-response.pl

package info (click to toggle)
libhijk-perl 0.28-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 260 kB
  • sloc: perl: 1,372; makefile: 8
file content (29 lines) | stat: -rw-r--r-- 624 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#!/usr/bin/env perl

use strict;
use warnings;
use Benchmark ':all';
use Hijk;
use HTTP::Tiny;
use LWP::UserAgent;
use HTTP::Request;
my $req = HTTP::Request->new('GET','http://localhost:5000/');
my $tiny = HTTP::Tiny->new();
my $lwp = LWP::UserAgent->new();

cmpthese(10_000,{
    'lwp____' => sub {
        my $res = $lwp->request($req);
    },
    'tiny___' => sub {
        my $res = $tiny->get('http://localhost:5000/');
    },
    'hijk pp' => sub {
        my $res = Hijk::request({
            path => "/",
            host => 'localhost',
            port => 5000,
            method => 'GET'
        });
    }
});