GitXplorerGitXplorer
a

hyperll

public
22 stars
2 forks
4 issues

Commits

List of commits on branch master.
Unverified
3973ac74fad6634b169bc8ca93ce551ee5bfd102

Bumps to 0.3.3

aalindeman committed 11 years ago
Unverified
77ca898383ec65ca1872d37aced1e911443af41b

Guards against strings being cleaned up from under us

aalindeman committed 11 years ago
Unverified
39371ba5d0b4f194c2f251a6bfb979f68ec3d4df

Not pure Ruby anymore :)

aalindeman committed 11 years ago
Unverified
db89829f3f77a6159ddd35865d8d63b64e965161

Bumps to 0.3.2

aalindeman committed 11 years ago
Unverified
f3a86a2fdb8557c781a2f23a5192c2bfc14b05bc

Adds merge_performance spec

aalindeman committed 11 years ago
Unverified
d24920211c81161f3b443b494110d9b6c1b19106

Implements serialize in C

aalindeman committed 11 years ago

README

The README file for this repository.

Hyperll Build Status Coverage Status

HyperLogLog implementation for Ruby. Originally written in pure Ruby, many pieces were rewritten in C for increased performance.

Usage

HyperLogLog stores an estimation of the cardinality of a set. It can be merged with other HyperLogLog instances.

hll = Hyperll::HyperLogLog.new(10)
hll.offer(1)
hll.offer(2)
hll.offer(3)
hll.cardinality # => 3

hll2 = Hyperll::HyperLogLog.new(10)
hll2.offer(3)
hll2.offer(4)
hll2.offer(5)
hll.cardinality # => 3

merged = Hyperll::HyperLogLog.new(10)
merged.merge(hll, hll2)
merged.cardinality # => 5

Serialization

HyperLogLog can be serialized to a binary string. It is compatible with the binary format from the Java stream-lib library.

hll = Hyperll::HyperLogLog.new(4)
hll.offer(1)
hll.offer(2)
hll.offer(3)
hll.serialize # => "\x00\x00\x00\x04\x00\x00\x00\f\x02\x00\x00\x00\x00\x00\x88\x00\x00\x00\x00\x00"

hll2 = Hyperll::HyperLogLog.unserialize("\x00\x00\x00\x04\x00\x00\x00\f\x02\x00\x00\x00\x00\x00\x88\x00\x00\x00\x00\x00")
hll2.cardinality # => 3