/client-libraries/ruby/bench.rb
Ruby | 15 lines | 12 code | 3 blank | 0 comment | 0 complexity | 458a3031349b8b185bb0851e232bf1ca MD5 | raw file
Possible License(s): BSD-3-Clause
1require 'benchmark' 2$:.push File.join(File.dirname(__FILE__), 'lib') 3require 'redis' 4 5times = 20000 6 7@r = Redis.new 8@r['foo'] = "The first line we sent to the server is some text" 9Benchmark.bmbm do |x| 10 x.report("set") { 20000.times {|i| @r["foo#{i}"] = "The first line we sent to the server is some text"; @r["foo#{i}"]} } 11end 12 13@r.keys('*').each do |k| 14 @r.delete k 15end