Posted by aaron
on Tuesday, April 08
Curb is a ruby binding for
libcurl. We've had sporadic issues with Net::HTTP, which this might aleviate via native dns, native timeouts, performance improvements, etc. It wouldnt be hard to re-implement ActiveResource, rfacebook, myspace-ruby, etc to use it instead. Anyone using this already?
sudo gem install curb
require 'rubygems'
require 'curb'
require "net/http"
require 'benchmark'
iterations = 40
Benchmark.bm do |x|
x.report("curb") do
iterations.times do
c = Curl::Easy.perform("http://www.google.com")
#puts c.body_str
end
end
x.report("net/http") do
iterations.times do
http = Net::HTTP.start("www.google.com")
req = Net::HTTP::Get.new("/")
res = http.request(req)
#puts res.body
end
end
end
user system total real
curb 0.010000 0.030000 0.040000 ( 4.019197)
net/http 0.140000 0.110000 0.250000 ( 4.155106)