summaryrefslogtreecommitdiff
path: root/examples/redis-unstable/utils/hyperloglog/hll-err.rb
diff options
context:
space:
mode:
authorMitja Felicijan <mitja.felicijan@gmail.com>2026-01-21 22:52:54 +0100
committerMitja Felicijan <mitja.felicijan@gmail.com>2026-01-21 22:52:54 +0100
commitdcacc00e3750300617ba6e16eb346713f91a783a (patch)
tree38e2d4fb5ed9d119711d4295c6eda4b014af73fd /examples/redis-unstable/utils/hyperloglog/hll-err.rb
parent58dac10aeb8f5a041c46bddbeaf4c7966a99b998 (diff)
downloadcrep-dcacc00e3750300617ba6e16eb346713f91a783a.tar.gz
Remove testing data
Diffstat (limited to 'examples/redis-unstable/utils/hyperloglog/hll-err.rb')
-rw-r--r--examples/redis-unstable/utils/hyperloglog/hll-err.rb30
1 files changed, 0 insertions, 30 deletions
diff --git a/examples/redis-unstable/utils/hyperloglog/hll-err.rb b/examples/redis-unstable/utils/hyperloglog/hll-err.rb
deleted file mode 100644
index 1278397..0000000
--- a/examples/redis-unstable/utils/hyperloglog/hll-err.rb
+++ /dev/null
@@ -1,30 +0,0 @@
-# hll-err.rb - Copyright (C) 2014-Present Redis Ltd.
-#
-# Licensed under your choice of (a) the Redis Source Available License 2.0
-# (RSALv2); or (b) the Server Side Public License v1 (SSPLv1); or (c) the
-# GNU Affero General Public License v3 (AGPLv3).
-#
-# Check error of HyperLogLog Redis 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