Skip to content

Instantly share code, notes, and snippets.

@adriaant
Created November 26, 2010 01:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save adriaant/716155 to your computer and use it in GitHub Desktop.
Save adriaant/716155 to your computer and use it in GitHub Desktop.
rest-client gem is too slow
#!/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}")
@danmayer
Copy link

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment