0.2.0 • Published 7 years ago

node-hll v0.2.0

Weekly downloads
8
License
MIT
Repository
github
Last release
7 years ago

node-hll

This is a native HyperLogLog lib (A wrap for avz/hll).

matcha benchmark result

                      HLL
      12,555,981 op/s » add const string
      11,999,272 op/s » add const buffer
       5,545,313 op/s » add cnt++
       2,477,867 op/s » add random
       1,380,207 op/s » toBuffer
           6,964 op/s » intersection

Memory usage and error values

bitssize (bytes)standard error
41626.00%
53218.38%
66413.00%
71289.19%
82566.50%
95124.60%
1010243.25%
1120482.30%
1240961.62%
1381921.15%
14163840.81%
15327680.57%
16655360.41%
171310720.29%
182621440.20%
195242880.14%
2010485760.10%

Example

const HLL = require('node-hll');

const hll = new HLL(5);

// Add item to hll counter.
hll.add('1');
hll.add(new Buffer('2'));

console.log(hll.bits);
console.log(hll.count());
console.log(hll.toBuffer());

// Create HLL from buffer.
console.log(new HLL(hll.toBuffer()).count());

const hll2 = new HLL(5);
hll2.add('3');
hll2.merge(hll);
console.log(hll2.count());

const hll3 = new HLL(5);
hll3.add('8');
hll3.add('1');

console.log(HLL.intersectionSize([hll, hll2]));
console.log(HLL.intersectionSize([hll, hll2, hll3]));
0.2.0

7 years ago

0.1.1

7 years ago

0.1.0

7 years ago