#!/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->request($httpreq) } }, 'lwp-parallel' => sub { $pua->initialize; $pua->nonblock(1); for ( 1 .. 10 ) { $pua->register($httpreq) } $pua->wait; } } );
Benchmark: timing 100 iterations of curl, lwp, lwp-parallel... curl: 26 wallclock secs ( 1.04 usr + 0.15 sys = 1.19 CPU) @ 84 +.03/s (n=100) lwp: 30 wallclock secs ( 6.86 usr + 0.51 sys = 7.37 CPU) @ 13 +.57/s (n=100) lwp-parallel: 34 wallclock secs (11.07 usr + 0.53 sys = 11.60 CPU) @ + 8.62/s (n=100)
In reply to Re: Re^3: First impressions of WWW::Curl::Lite
by sri
in thread First impressions of WWW::Curl::Lite
by sri
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |