]> git.saurik.com Git - redis.git/blame - client-libraries/ruby/speed.rb
Ruby client library updated. Important changes in this new version!
[redis.git] / client-libraries / ruby / speed.rb
CommitLineData
29fac617 1require 'benchmark'
2require "#{File.dirname(__FILE__)}/lib/redis"
3
4r = Redis.new
5n = (ARGV.shift || 20000).to_i
6
7elapsed = Benchmark.realtime do
8 # n sets, n gets
9 n.times do |i|
10 key = "foo#{i}"
11 r[key] = key * 10
12 r[key]
13 end
14end
15
16puts '%.2f Kops' % (2 * n / 1000 / elapsed)