WWW::Curl vs LWP
機能に差があるので、公平なテストじゃないけどWWW::Curl速い
結果
Benchmark: timing 500 iterations of curl, lwp...
curl: 1 wallclock secs ( 0.31 usr + 0.30 sys = 0.61 CPU) @ 819.67/s (n=500)
lwp: 4 wallclock secs ( 3.13 usr + 0.37 sys = 3.50 CPU) @ 142.86/s (n=500)
スクリプト
use Benchmark; use LWP::UserAgent; use WWW::Curl::Easy; my $count = 500; timethese( $count , { 'curl' => sub { open(my $content_fh, '>', \my $content); open(my $header_fh, '>', \my $header); my $curl = WWW::Curl::Easy->new(); $curl->setopt( CURLOPT_WRITEDATA, $content_fh); $curl->setopt( CURLOPT_WRITEHEADER, $header_fh); $curl->setopt( CURLOPT_URL, 'http://localhost/' ); $curl->perform(); }, 'lwp' => sub { my $ua = LWP::UserAgent->new; my $res = $ua->get('http://localhost/'); } });
created by blog.nomadscafe.jp
コメント
コメントを投稿
コメントを投稿するにはログインが必要です
同じサーバのApacheBenchの結果