mirror of
https://codeberg.org/redict/redict.git
synced 2025-01-23 08:38:27 -05:00
17 lines
289 B
Ruby
17 lines
289 B
Ruby
|
require 'benchmark'
|
||
|
require "#{File.dirname(__FILE__)}/lib/redis"
|
||
|
|
||
|
r = Redis.new
|
||
|
n = (ARGV.shift || 20000).to_i
|
||
|
|
||
|
elapsed = Benchmark.realtime do
|
||
|
# n sets, n gets
|
||
|
n.times do |i|
|
||
|
key = "foo#{i}"
|
||
|
r[key] = key * 10
|
||
|
r[key]
|
||
|
end
|
||
|
end
|
||
|
|
||
|
puts '%.2f Kops' % (2 * n / 1000 / elapsed)
|