Skip to content

Instantly share code, notes, and snippets.

@orend
Created June 28, 2011 19:39
Show Gist options
  • Save orend/1052006 to your computer and use it in GitHub Desktop.
Save orend/1052006 to your computer and use it in GitHub Desktop.
def bench(descr)
start = Time.now
yield
puts "#{descr} #{Time.now-start} seconds"
end
def without_pipelining(u)
r = Redis.new
10000.times {
r.sadd(u.deleted_fls.key, 43)
}
end
def with_pipelining(u)
r = Redis.new
r.pipelined {
10000.times {
r.sadd(u.deleted_fls.key, 43)
}
}
end
bench("without pipelining") {
without_pipelining(u)
}
bench("with pipelining") {
with_pipelining(u)
}
without pipelining 1.500497 seconds
with pipelining 0.402737 seconds
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment