Skip to content

Instantly share code, notes, and snippets.

@chrislloyd
Created August 16, 2011 00:03
Show Gist options
  • Save chrislloyd/1148175 to your computer and use it in GitHub Desktop.
Save chrislloyd/1148175 to your computer and use it in GitHub Desktop.
require 'benchmark'
require 'redis'
require 'digest/md5'
n = 10000
redis = Redis.new
Benchmark.bm do |bm|
bm.report do
n.times { Digest::MD5.hexdigest 'christopher.lloyd@gmail.com' }
end
redis.set 'benchmark:gravatastic',
Digest::MD5.hexdigest('christopher.lloyd@gmail.com')
bm.report do
n.times { redis.get 'benchmark:gravatastic' }
end
end
user system total real
0.020000 0.000000 0.020000 ( 0.026320)
0.390000 0.280000 0.670000 ( 1.691016)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment