Skip to content

Instantly share code, notes, and snippets.

@ogijun
Created January 8, 2011 05:52
Show Gist options
  • Save ogijun/770589 to your computer and use it in GitHub Desktop.
Save ogijun/770589 to your computer and use it in GitHub Desktop.
require 'curb'
require 'net/http'
require 'open-uri'
require 'benchmark'
Net::HTTP.version_1_2
n = 100
Benchmark.bm do |x|
x.report {
n.times do
f = open('http://127.0.0.1/')
end
}
x.report {
n.times do
Net::HTTP.start('127.0.0.1', 80) {|http| http.get('/') }
end
}
x.report {
n.times do
c = Curl::Easy.new('http://127.0.0.1/')
c.perform
end
}
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment