Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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
You can’t perform that action at this time.