Created
March 23, 2009 14:33
-
-
Save bastos/83566 to your computer and use it in GitHub Desktop.
Little benchmark between Curl and Net::Http
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
require 'benchmark' | |
require 'rubygems' | |
require 'curl' | |
require 'net/http' | |
URL = "URL HERE" | |
Benchmark.bm do|b| | |
b.report("CURL") do | |
1000.times do | |
Curl::Easy.new("#{URL}").perform | |
end | |
end | |
b.report("STANDARD") do | |
1000.times do | |
Net::HTTP.get_response(URI.parse("#{URL}")) | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment