-
-
Save bbrowning/24cfdba60ce1cdc887cc to your computer and use it in GitHub Desktop.
This file contains 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 'benchmark' | |
require 'openssl' | |
NUM_THREADS = 40 | |
NUM_DIGESTS = 100_000 | |
puts Benchmark.measure { | |
threads = NUM_THREADS.times.map do | |
Thread.new do | |
secret = 'foobarbaz' | |
data = 'bingobongo'*100 | |
NUM_DIGESTS.times do | |
OpenSSL::HMAC.hexdigest(OpenSSL::Digest::SHA1.new, secret, data) | |
end | |
end | |
end | |
threads.each(&:join) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment