Skip to content

Instantly share code, notes, and snippets.

@swapab
Last active December 31, 2015 05:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save swapab/7944591 to your computer and use it in GitHub Desktop.
Save swapab/7944591 to your computer and use it in GitHub Desktop.
real-time benchmark - total count
#Test data set - 100K
(1..100000).each do |t|
redis.zadd 'ZSORT', t.minutes.ago.to_i, "#{t}-minute-ago"
end
=========================================================================================
2.0.0p195 :210 > Benchmark.bmbm do |bm|
bm.report{
puts redis.eval("return #redis.call('zrangebyscore', 'ZSORT', #{11.months.ago.to_i}, #{1.months.ago.to_i})")
}
end
Rehearsal ------------------------------------
*56810*
0.000000 0.000000 0.000000 ( 0.060274)
--------------------------- total: 0.000000sec
user system total real
56810
0.000000 0.000000 0.000000 ( 0.043863)
=> [#<Benchmark::Tms:0xa2b1d94 @label="", @real=0.043863021, @cstime=0.0, @cutime=0.0, @stime=0.0, @utime=0.0, @total=0.0>]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment