Skip to content

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
require 'rubygems'
require 'curb'
require "net/http"
require 'benchmark'
# http://0.0.0.0:8080
#
# class HomeController < ApplicationController
# def index
# sleep 3
# end
# end
# [lifo@null curb (master)]£ ruby bench.rb
# Curl::Multi 3.01691508293152
# Net::HTTP 15.0276219844818
responses = {}
curb = Benchmark.realtime do
m = Curl::Multi.new
5.times do |i|
responses[i] = ""
c = Curl::Easy.new('http://0.0.0.0:8080') do |curl|
curl.follow_location = false
curl.on_body{|data| responses[i] << data; data.size }
end
m.add(c)
end
m.perform
end
puts "Curl::Multi #{curb}"
nh = Benchmark.realtime do
5.times do
http = Net::HTTP.start('0.0.0.0', 8080)
res = http.request(Net::HTTP::Get.new("/"))
end
end
puts "Net::HTTP #{nh}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.