#!/usr/bin/perl -w use strict; use Benchmark qw(:all); use WWW::Curl::Lite::Request; use WWW::Curl::Lite; use LWP::UserAgent; use LWP::Parallel::UserAgent; use HTTP::Request; my $request = new WWW::Curl::Lite::Request( { url => 'http://127.0.0.1' } ); my $curl = new WWW::Curl::Lite; my $ua = new LWP::UserAgent; my $pua = new LWP::Parallel::UserAgent; my $httpreq = new HTTP::Request( GET => 'http://127.0.0.1' ); timethese( 100, { 'curl' => sub { for ( 1 .. 10 ) { $curl->register($request) } $curl->request; }, 'lwp' => sub { for ( 1 .. 10 ) { $ua->get('http://127.0.0.1') } }, 'lwp-parallel' => sub { $pua->initialize; $pua->nonblock(1); for ( 1 .. 10 ) { $pua->register($httpreq) } $pua->wait; } } );