Created
November 26, 2010 01:22
-
-
Save adriaant/716155 to your computer and use it in GitHub Desktop.
rest-client gem is too slow
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 'rest_client' | |
require 'net/http' | |
require 'benchmark' | |
time = Benchmark.realtime do | |
url = URI.parse('http://bit.ly/4okpb2') | |
req = Net::HTTP::Head.new(url.path) | |
res = Net::HTTP.start(url.host, url.port) {|http| http.request(req) } | |
end | |
printf("NET::HTTP => Time elapsed %0.3f seconds\n", "#{time}") | |
time = Benchmark.realtime do | |
RestClient.head('http://bit.ly/4okpb2') | |
end | |
printf("RestClient => Time elapsed %0.3f seconds\n", "#{time}") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Very interesting, but weird... I ran a few more tests to dig in as we use rest-client fairly often.
https://gist.github.com/danmayer/6104806
Any idea why it would very so much, seemingly more related to bitly requests verus others?