Skip to content

Instantly share code, notes, and snippets.

@khamanaka
Created April 13, 2011 03:23
Show Gist options
  • Save khamanaka/916905 to your computer and use it in GitHub Desktop.
Save khamanaka/916905 to your computer and use it in GitHub Desktop.
#! /usr/bin/env ruby
require 'benchmark'
require 'net/http'
REQUEST_URI_BASE = URI.parse('http://www.yahoo.co.jp/')
def http_request(uri)
http = Net::HTTP.new(uri.host, uri.port)
http.start do |request|
request.get(uri.path)
end
end
Benchmark.bm do |x|
x.report do
http_request(REQUEST_URI_BASE)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment