Sha256: ef547fc6706b8c444ca20d1544628a015d866d3f10b96674ce8956010ab2eaf8

Contents?: true

Size: 1022 Bytes

Versions: 14

Compression:

Stored size: 1022 Bytes

Contents

require 'benchmark'
$:.push File.join(File.dirname(__FILE__), 'lib')
require 'redis'

times = 20000

@r = Redis.new#(:debug => true)
@r['foo'] = "The first line we sent to the server is some text"

Benchmark.bmbm do |x|
  x.report("set") do
    20000.times do |i|
      @r["set#{i}"] = "The first line we sent to the server is some text"; @r["foo#{i}"]
    end
  end
  
  x.report("set (pipelined)") do
    @r.pipelined do |pipeline|
      20000.times do |i|
        pipeline["set_pipelined#{i}"] = "The first line we sent to the server is some text"; @r["foo#{i}"]
      end
    end
  end
  
  x.report("push+trim") do
    20000.times do |i|
      @r.push_head "push_trim#{i}", i
      @r.list_trim "push_trim#{i}", 0, 30
    end
  end
  
  x.report("push+trim (pipelined)") do
    @r.pipelined do |pipeline|
      20000.times do |i|
        pipeline.push_head "push_trim_pipelined#{i}", i
        pipeline.list_trim "push_trim_pipelined#{i}", 0, 30
      end
    end
  end
end

@r.keys('*').each do |k|
  @r.delete k
end

Version data entries

14 entries across 14 versions & 3 rubygems

Version Path
lunar-0.4.1 vendor/redis/benchmarking/pipeline.rb
lunar-0.4.0 vendor/redis/benchmarking/pipeline.rb
lunar-0.3.0 vendor/redis/benchmarking/pipeline.rb
lunar-0.2.3 vendor/redis/benchmarking/pipeline.rb
lunar-0.2.2 vendor/redis/benchmarking/pipeline.rb
lunar-0.2.1 vendor/redis/benchmarking/pipeline.rb
lunar-0.2.0 vendor/redis/benchmarking/pipeline.rb
lunar-0.1.1 vendor/redis/benchmarking/pipeline.rb
lunar-0.1.0 vendor/redis/benchmarking/pipeline.rb
vanity-1.3.0 vendor/redis-rb/bench.rb
mikeg-vanity-1.3.0 vendor/redis-rb/bench.rb
vanity-1.2.0 vendor/redis-rb/bench.rb
vanity-1.1.1 vendor/redis-rb/bench.rb
vanity-1.1.0 vendor/redis-rb/bench.rb