hyperll 0.2.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/hyperll/hyper_log_log_plus.rb +6 -0
- data/lib/hyperll/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 078a9aafd86d9c1ffa575e83b0ed2826a5605afa
|
4
|
+
data.tar.gz: 174892051165cea609a7b77476adb88afad2cd1a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ac15ed412c66ab1bd72e7cc71c0ba57ba85ee410c333a3fc71e4e624d6b9046a3dccd106a86354245668400f492c8f09762bdbf9e902a63665568965f41f8771
|
7
|
+
data.tar.gz: 003a2c5236fd3b94a02a5fa0d3dce615b04feb5ea2c04f21aa34663200d607196b0112fce34bf759f8c93323934938f5d1df46da5fc4eb3eda039c63a5fa8820
|
@@ -125,6 +125,7 @@ module Hyperll
|
|
125
125
|
|
126
126
|
if sp > 0
|
127
127
|
@sparse_count = 2 ** sp
|
128
|
+
@sparse_set_threshold = 0.75 * @count
|
128
129
|
@sparse_set = sparse_set || []
|
129
130
|
end
|
130
131
|
|
@@ -157,6 +158,7 @@ module Hyperll
|
|
157
158
|
case [format, other.format]
|
158
159
|
when [:sparse, :sparse]
|
159
160
|
@sparse_set = merge_sparse_set(other.sparse_set)
|
161
|
+
convert_to_normal_if_above_sparse_threshold
|
160
162
|
when [:normal, :normal]
|
161
163
|
@register_set.merge(other.register_set)
|
162
164
|
when [:sparse, :normal]
|
@@ -186,6 +188,10 @@ module Hyperll
|
|
186
188
|
self
|
187
189
|
end
|
188
190
|
|
191
|
+
def convert_to_normal_if_above_sparse_threshold
|
192
|
+
convert_to_normal if @sparse_set.length > @sparse_set_threshold
|
193
|
+
end
|
194
|
+
|
189
195
|
def serialize
|
190
196
|
str = ""
|
191
197
|
str << [-2].pack("N") # -VERSION
|
data/lib/hyperll/version.rb
CHANGED