estimate

fun estimate(encodedItem: ByteArray): Long

Estimate the number of times encodedItem has been added.

Use this overload when the caller already holds or can cache the UTF-8 encoding of the key — it avoids the ByteArray allocation that estimate(String) performs on every call.

Because replicas merge via element-wise maximum, a merged sketch reflects the replica that observed the item most — it is NOT the sum across replicas. The estimate is always ≥ the true count seen by any single merged replica, and within the Count-Min error bound with high probability.


fun estimate(item: String): Long

Estimate the number of times item has been added. Because replicas merge via element-wise maximum, a merged sketch reflects the replica that observed the item most — it is NOT the sum across replicas. The estimate is always ≥ the true count seen by any single merged replica, and within the Count-Min error bound with high probability.

For high-frequency hot paths where the same key is estimated many times, prefer estimate(ByteArray) with a cached encoding to avoid per-call allocation.