
This includes comments used for module API documentation. * Strategy for replacement: Regex search: `(//|/\*| \*|#).* ("|\()?(r|R)edis( |\. |'|\n|,|-|\)|")(?!nor the names of its contributors)(?!Ltd.)(?!Labs)(?!Contributors.)` * Don't edit copyright comments * Replace "Redis version X.X" -> "Redis OSS version X.X" to distinguish from newly licensed repository * Replace "Redis Object" -> "Object" * Exclude markdown for now * Don't edit Lua scripting comments referring to redis.X API * Replace "Redis Protocol" -> "RESP" * Replace redis-benchmark, -cli, -server, -check-aof/rdb with "valkey-" prefix * Most other places, I use best judgement to either remove "Redis", or replace with "the server" or "server" Fixes #148 --------- Signed-off-by: Jacob Murphy <jkmurphy@google.com> Signed-off-by: Viktor Söderqvist <viktor.soderqvist@est.tech>
28 lines
631 B
Ruby
28 lines
631 B
Ruby
# hll-err.rb - Copyright (C) 2014 Salvatore Sanfilippo
|
|
# BSD license, See the COPYING file for more information.
|
|
#
|
|
# Check error of HyperLogLog implementation for different set sizes.
|
|
|
|
require 'rubygems'
|
|
require 'redis'
|
|
require 'digest/sha1'
|
|
|
|
r = Redis.new
|
|
r.del('hll')
|
|
i = 0
|
|
while true do
|
|
100.times {
|
|
elements = []
|
|
1000.times {
|
|
ele = Digest::SHA1.hexdigest(i.to_s)
|
|
elements << ele
|
|
i += 1
|
|
}
|
|
r.pfadd('hll',elements)
|
|
}
|
|
approx = r.pfcount('hll')
|
|
abs_err = (approx-i).abs
|
|
rel_err = 100.to_f*abs_err/i
|
|
puts "#{i} vs #{approx}: #{rel_err}%"
|
|
end
|