public void HighCardinalityMergeWithPool() { var sw = Stopwatch.StartNew(); var pool = HyperLogLogPlus.CreateMemPool(); var hll = new HyperLogLogPlus(18, 25, pool); var hll_t = new HyperLogLogPlus(18, 25, pool); var buf = new byte[8]; const int size = (int)100000; for (int i = 0; i < size / 100; ++i) { var hll3 = new HyperLogLogPlus(18, 25, pool); for (int j = 0; j < 100; ++j) { Rnd.NextBytes(buf); hll3.OfferHashed(Hash64(buf)); } hll_t = hll.Merge(hll3); hll.Dispose(); hll = hll_t; hll3.Dispose(); } Console.WriteLine("expected: {0}, estimate: {1}, time: {2}", size, hll.Cardinality(), sw.Elapsed); long estimate = hll.Cardinality(); double err = Math.Abs(estimate - size) / (double)size; Console.WriteLine("Percentage error: " + err); Assert.That(err, Is.LessThan(0.1)); hll.Dispose(); }