Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
Here comes a more complete benchmark, and HTTP::MHTTP won under these conditions!
#!/usr/bin/perl -w use strict; use Benchmark qw(:all); use lib 'src/WWW-Curl-Lite/lib'; use WWW::Curl::Lite::Request; use WWW::Curl::Lite; use LWP::UserAgent; use LWP::Parallel::UserAgent; use HTTP::Request; use HTTP::MHTTP; 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 $req = 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($req) } }, 'lwp-parallel' => sub { $pua->initialize; $pua->nonblock(1); for ( 1 .. 10 ) { $pua->register($req) } $pua->wait; }, 'mhttp' => sub { for ( 1 .. 10 ) { http_init(); http_call( "GET", "http://127.0.0.1" ); http_response(); } } } );
Benchmark: timing 100 iterations of curl, lwp, lwp-parallel, mhttp... curl: 21 wallclock secs ( 1.00 usr + 0.17 sys = 1.17 CPU) @ 85 +.47/s (n=100) lwp: 36 wallclock secs ( 6.75 usr + 0.53 sys = 7.28 CPU) @ 13 +.74/s (n=100) lwp-parallel: 38 wallclock secs (11.04 usr + 0.61 sys = 11.65 CPU) @ + 8.58/s (n=100) mhttp: 32 wallclock secs ( 0.19 usr + 0.26 sys = 0.45 CPU) @ 22 +2.22/s (n=100)
A real world benchmark with timeouts and other exceptions would be much more interesting, so don't take this one too serious.

In reply to Re: Re: Re: Re: First impressions of WWW::Curl::Lite by sri
in thread First impressions of WWW::Curl::Lite by sri

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others having a coffee break in the Monastery: (4)
As of 2024-03-29 05:27 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found