Skip to content

Instantly share code, notes, and snippets.

@NetguruGist
Created October 31, 2015 14:51
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 NetguruGist/3cc4957974c29f1485fc to your computer and use it in GitHub Desktop.
Save NetguruGist/3cc4957974c29f1485fc to your computer and use it in GitHub Desktop.
amazon1 ruby
require 'benchmark'
require 'open-uri'
iterations = ARGV.first.to_i
S3_URL = 'http://s3.amazonaws.com/<supersecret>/images/1.original.jpg?1438008505'
CLOUDFRONT_URL = 'http://<supersecret>.cloudfront.net/images/1.original.jpg?1438008505'
Benchmark.bmbm(10) do |x|
x.report('cloudfront') { iterations.times{ open(CLOUDFRONT_URL) } }
x.report('s3') { iterations.times{ open(S3_URL) } }
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment