Sha256: 24a8284c3d6e98a178fb5f60a81f5c7810eb6abd58b5030c910d9d64811cc806
Contents?: true
Size: 878 Bytes
Versions: 2
Compression:
Stored size: 878 Bytes
Contents
require "benchmark" $:.push File.join(File.dirname(__FILE__), 'lib') require 'redis' ITERATIONS = 10000 @r = Redis2.new Benchmark.bmbm do |benchmark| benchmark.report("set") do @r.flushdb ITERATIONS.times do |i| @r.set("foo#{i}", "Hello world!") @r.get("foo#{i}") end end benchmark.report("set (pipelined)") do @r.flushdb @r.pipelined do ITERATIONS.times do |i| @r.set("foo#{i}", "Hello world!") @r.get("foo#{i}") end end end benchmark.report("lpush+ltrim") do @r.flushdb ITERATIONS.times do |i| @r.lpush "lpush#{i}", i @r.ltrim "ltrim#{i}", 0, 30 end end benchmark.report("lpush+ltrim (pipelined)") do @r.flushdb @r.pipelined do ITERATIONS.times do |i| @r.lpush "lpush#{i}", i @r.ltrim "ltrim#{i}", 0, 30 end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
redis2-namespaced-3.0.7.1 | benchmarking/pipeline.rb |
redis2-namespaced-3.0.7 | benchmarking/pipeline.rb |