public
Last active

Twitter API SSL Benchmarks

  • Download Gist
twitter_ssl_bench.rb
Ruby
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39
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 |

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.