Skip to content

Instantly share code, notes, and snippets.

@sreeix
Created March 28, 2012 12:55
Show Gist options
  • Select an option

  • Save sreeix/2225900 to your computer and use it in GitHub Desktop.

Select an option

Save sreeix/2225900 to your computer and use it in GitHub Desktop.
Redis Pipelined
r = Redis.new
Benchmark.bmbm do |b|
b.report("With pipelined") do
r.pipelined { 100000.times{|i| r.set("test#{i}", i)} }
end
b.report("With pipelined inside") do
100000.times{|i| r.pipelined {r.set( "test#{i}", i)} }
end
b.report("No pipeline") do
100000.times{|i| r.set("test#{i}", i)}
end
end
Rehearsal ---------------------------------------------------------
With pipelined 0.520000 0.010000 0.530000 ( 0.705547)
With pipelined inside 2.300000 1.680000 3.980000 ( 7.199414)
No pipeline 1.730000 1.620000 3.350000 ( 6.429091)
------------------------------------------------ total: 7.860000sec
user system total real
With pipelined 0.410000 0.010000 0.420000 ( 0.559689)
With pipelined inside 2.280000 1.640000 3.920000 ( 7.084943)
No pipeline 1.780000 1.590000 3.370000 ( 6.435733)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment