]>
Commit | Line | Data |
---|---|---|
1 | require 'benchmark' | |
2 | require "#{File.dirname(__FILE__)}/lib/redis" | |
3 | ||
4 | r = Redis.new | |
5 | n = (ARGV.shift || 20000).to_i | |
6 | ||
7 | elapsed = 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 | |
14 | end | |
15 | ||
16 | puts '%.2f Kops' % (2 * n / 1000 / elapsed) |