65 Commits

Author SHA1 Message Date
antirez
e67d55d949 HyperLogLog internal representation modified.
The new representation is more obvious, starting from the LSB of the
first byte and using bits going to MSB, and passing to next byte as
needed.

There was also a subtle error: first two bits were unused, everything
was carried over on the right of two bits, even if it worked because of
the code requirement of always having a byte more at the end.

During the rewrite the code was made safer trying to avoid undefined
behavior due to shifting an uint8_t for more than 8 bits.
2014-03-29 16:04:27 +01:00
antirez
105ead7ea6 Remove a few useless operations from hllCount() fast path. 2014-03-29 12:17:56 +01:00
antirez
7c8277cc75 HLLCOUNT 3x faster taking fast path for default params. 2014-03-29 12:12:44 +01:00
antirez
0c280053dd Use processor base types in HLL_(GET|SET)_REGISTER.
This speedups the macros by a noticeable factor.
2014-03-29 08:37:01 +01:00
antirez
4983350c6c HyperLogLog: use precomputed table for 2^(-M[i]). 2014-03-28 22:49:24 +01:00
antirez
e6874512b9 HyperLogLog algorithm fixed in two ways.
There was an error in the computation of 2^register, and the sequence of
zeroes computed after the hashing did not included the "1".
2014-03-28 18:24:05 +01:00
antirez
cde7093b10 HLLCOUNT implemented. 2014-03-28 17:37:18 +01:00
antirez
abb0b21919 HLLADD implemented. 2014-03-28 16:24:35 +01:00
antirez
55c7347125 hllAdd() low level HyperLogLog "add" implemented. 2014-03-28 14:42:30 +01:00
antirez
1954abf924 HyperLogLog: redefine constants using "P". 2014-03-28 14:09:28 +01:00
antirez
d1e473cacf HLL_SET_REGISTER fixed.
There was an error in the first version of the macro.
Now the HLLSELFTEST test reports success.
2014-03-28 13:56:07 +01:00
antirez
2084bf44b6 Use REDIS_HLL_REGISTER_MAX when possible. 2014-03-28 12:16:39 +01:00
antirez
c359fd89a5 HLL_(SET|GET)_REGISTER types fixed. 2014-03-28 12:15:46 +01:00
antirez
61f3239044 HLLSELFTEST command implemented.
To test the bitfield array of counters set/get macros from the Redis Tcl
suite is hard, so a specialized command that is able to test the
internals was developed.
2014-03-28 12:11:55 +01:00
antirez
5669bf9643 HyperLogLog: initial sketch of registers access. 2014-03-28 11:18:48 +01:00