Created
May 24, 2016 12:40
-
-
Save groyoh/acb482c7f7915547fa9830f815871c81 to your computer and use it in GitHub Desktop.
Aws Cf Signer vs Cloudfront Signer
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| require "bundler/inline" | |
| gemfile(true) do | |
| source "https://rubygems.org" | |
| gem "cloudfront-signer" | |
| gem "aws_cf_signer" | |
| gem "benchmark-ips" | |
| end | |
| GC.start | |
| GC.disable | |
| PATH_TO_KEY = '/path/to/key' | |
| Aws::CF::Signer.configure do |config| | |
| config.key_path = PATH_TO_KEY | |
| end | |
| SIGNER = AwsCfSigner.new(PATH_TO_KEY) | |
| PATH = 'http://d604721fxaaqy9.cloudfront.net/horizon.jpg?large=yes&license=yes' | |
| Benchmark.ips do |x| | |
| x.warmup = 20 | |
| x.report("Cloudfront signer") do | |
| Aws::CF::Signer.sign_url PATH, expires: Time.now + 600 | |
| end | |
| x.report("AWS Cf Signer") do | |
| SIGNER.sign(PATH, :ending => Time.now + 600) | |
| end | |
| x.compare! | |
| end | |
| __END__ | |
| Warming up -------------------------------------- | |
| Cloudfront signer 14.000 i/100ms | |
| AWS Cf Signer 14.000 i/100ms | |
| Calculating ------------------------------------- | |
| Cloudfront signer 148.320 (± 7.4%) i/s - 742.000 in 5.036355s | |
| AWS Cf Signer 148.736 (± 9.4%) i/s - 742.000 in 5.055257s | |
| Comparison: | |
| AWS Cf Signer: 148.7 i/s | |
| Cloudfront signer: 148.3 i/s - same-ish: difference falls within error |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment