Created
June 28, 2011 19:39
-
-
Save orend/1052006 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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