Sha256: 21be1367f74736bf0ab5792a57f4924e2d933e25cd2d0a6ddc8a4d80bbc5daaf
Contents?: true
Size: 877 Bytes
Versions: 94
Compression:
Stored size: 877 Bytes
Contents
require "benchmark" $:.push File.join(File.dirname(__FILE__), 'lib') require 'redis' ITERATIONS = 10000 @r = Redis.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
94 entries across 92 versions & 15 rubygems