Skip to content

Instantly share code, notes, and snippets.

@sferik
Created October 28, 2010 21:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sferik/652330 to your computer and use it in GitHub Desktop.
Save sferik/652330 to your computer and use it in GitHub Desktop.
Twitter API SSL Benchmarks
require 'rubygems'
require 'rbench'
require 'twitter'
class Bench
def self.setup
Twitter.configure do |config|
config.consumer_key = CONSUMER_KEY
config.consumer_secret = CONSUMER_SECRET
config.oauth_token = OAUTH_TOKEN
config.oauth_token_secret = OAUTH_TOKEN_SECRET
end
end
def self.no_ssl
Twitter.endpoint = 'http://api.twitter.com/1/'
Twitter.friends
end
def self.ssl
Twitter.endpoint = 'https://api.twitter.com/1/'
Twitter.friends
end
end
RBench.run(100) do
column :one, :title => "HTTP"
column :two, :title => "HTTPS"
Bench.setup
report "HTTP vs. HTTPS" do
one { Bench.no_ssl }
two { Bench.ssl }
end
end
__END__
HTTP | HTTPS |
------------------------------------------
HTTP vs. HTTPS 262.061 | 240.705 |
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment