Skip to content

knotkit/scalar-sketch

Provides reducible Bloom filter, HyperLogLog, Count-Min Sketch, and MinHash sketches over four scalar domains

import {
function stringSplitBlockBloomFilter(options: SplitBlockBloomFilterOptions): StringSplitBlockBloomFilter

Create a string-specialized Parquet-algorithm split-block Bloom filter.

@throws ― {ScalarSketchInvalidInputError} With INVALID_DIMENSION, INVALID_PROBABILITY, or STATE_TOO_LARGE for invalid options.

@throws ― {HashInvalidInputError} From knotkit/hash for an invalid seed.

stringSplitBlockBloomFilter
} from 'knotkit/scalar-sketch'
const
const filter: StringSplitBlockBloomFilter
filter
=
function stringSplitBlockBloomFilter(options: SplitBlockBloomFilterOptions): StringSplitBlockBloomFilter

Create a string-specialized Parquet-algorithm split-block Bloom filter.

@throws ― {ScalarSketchInvalidInputError} With INVALID_DIMENSION, INVALID_PROBABILITY, or STATE_TOO_LARGE for invalid options.

@throws ― {HashInvalidInputError} From knotkit/hash for an invalid seed.

stringSplitBlockBloomFilter
({
SplitBlockBloomFilterOptions.expectedEntries: number

Expected number of updates used to size the initial filter.

expectedEntries
: 10_000,
SplitBlockBloomFilterOptions.targetFalsePositiveProbability?: number | undefined

Model target at expectedEntries. Defaults to 0.01.

targetFalsePositiveProbability
: 0.01,
SplitBlockBloomFilterOptions.seed?: bigint | undefined

Unsigned XXH64 seed. Defaults to 0n.

seed
: 7n,
})
const filter: StringSplitBlockBloomFilter
filter
.
StringSplitBlockBloomFilter.update: (value: string) => void

Add one string. O(length); mutates the filter.

@throws ― {HashInvalidInputError} From knotkit/hash for an invalid string.

@throws ― {ScalarSketchInvalidInputError} With CAPACITY_EXCEEDED when the update count is full.

update
('alpha')
const filter: StringSplitBlockBloomFilter
filter
.
StringSplitBlockBloomFilter.mightContain: (value: string) => boolean

Return false for a definite miss and true for a possible member. O(length).

@throws ― {HashInvalidInputError} From knotkit/hash for an invalid string.

mightContain
('alpha') // true — no false negatives
const filter: StringSplitBlockBloomFilter
filter
.
StringSplitBlockBloomFilter.mightContain: (value: string) => boolean

Return false for a definite miss and true for a possible member. O(length).

@throws ― {HashInvalidInputError} From knotkit/hash for an invalid string.

mightContain
('omega') // almost always false
const filter: StringSplitBlockBloomFilter
filter
.
SplitBlockBloomFilterMetadata.blockCount: number

Effective number of 256-bit blocks. Always a power of two.

blockCount
// 512 — a power of two, chosen by the model
scalar-sketch.ts
import {
function stringSplitBlockBloomFilter(options: SplitBlockBloomFilterOptions): StringSplitBlockBloomFilter

Create a string-specialized Parquet-algorithm split-block Bloom filter.

@throws ― {ScalarSketchInvalidInputError} With INVALID_DIMENSION, INVALID_PROBABILITY, or STATE_TOO_LARGE for invalid options.

@throws ― {HashInvalidInputError} From knotkit/hash for an invalid seed.

stringSplitBlockBloomFilter
} from 'knotkit/scalar-sketch'
import {
function deserializeScalarSketch(value: unknown): ScalarSketch

Deserialize exact state from untrusted canonical binary bytes. Shared envelope geometry, family dimensions, and state invariants are checked before mutable typed state is allocated.

@throws ― {ScalarSketchParseError} For malformed envelopes, unsupported scalar-sketch versions, unknown discriminants, or invalid family state.

@throws ― {HashParseError} From knotkit/hash for invalid hash identities.

deserializeScalarSketch
,
function serializeScalarSketch(sketch: ScalarSketch, options?: SerializeScalarSketchOptions): Uint8Array

Serialize exact scalar-sketch state into canonical binary bytes.

@throws ― {ScalarSketchInvalidInputError} With FOREIGN_STRUCTURE, WRONG_FAMILY, or STATE_TOO_LARGE when the value cannot be serialized.

serializeScalarSketch
} from 'knotkit/scalar-sketch/wire'
const
const options: {
expectedEntries: number;
seed: bigint;
}
options
= {
expectedEntries: number
expectedEntries
: 10_000,
seed: bigint
seed
: 7n }
const
const shard: StringSplitBlockBloomFilter
shard
=
function stringSplitBlockBloomFilter(options: SplitBlockBloomFilterOptions): StringSplitBlockBloomFilter

Create a string-specialized Parquet-algorithm split-block Bloom filter.

@throws ― {ScalarSketchInvalidInputError} With INVALID_DIMENSION, INVALID_PROBABILITY, or STATE_TOO_LARGE for invalid options.

@throws ― {HashInvalidInputError} From knotkit/hash for an invalid seed.

stringSplitBlockBloomFilter
(
const options: {
expectedEntries: number;
seed: bigint;
}
options
)
const
const other: StringSplitBlockBloomFilter
other
=
function stringSplitBlockBloomFilter(options: SplitBlockBloomFilterOptions): StringSplitBlockBloomFilter

Create a string-specialized Parquet-algorithm split-block Bloom filter.

@throws ― {ScalarSketchInvalidInputError} With INVALID_DIMENSION, INVALID_PROBABILITY, or STATE_TOO_LARGE for invalid options.

@throws ― {HashInvalidInputError} From knotkit/hash for an invalid seed.

stringSplitBlockBloomFilter
(
const options: {
expectedEntries: number;
seed: bigint;
}
options
)
const shard: StringSplitBlockBloomFilter
shard
.
StringSplitBlockBloomFilter.update: (value: string) => void

Add one string. O(length); mutates the filter.

@throws ― {HashInvalidInputError} From knotkit/hash for an invalid string.

@throws ― {ScalarSketchInvalidInputError} With CAPACITY_EXCEEDED when the update count is full.

update
('alpha')
const other: StringSplitBlockBloomFilter
other
.
StringSplitBlockBloomFilter.update: (value: string) => void

Add one string. O(length); mutates the filter.

@throws ― {HashInvalidInputError} From knotkit/hash for an invalid string.

@throws ― {ScalarSketchInvalidInputError} With CAPACITY_EXCEEDED when the update count is full.

update
('beta')
const shard: StringSplitBlockBloomFilter
shard
.
StringSplitBlockBloomFilter.merge: (other: StringSplitBlockBloomFilter) => void

Union a compatible filter into this filter. O(blockCount); mutates only this filter.

@throws ― {ScalarSketchInvalidInputError} With FOREIGN_STRUCTURE, WRONG_FAMILY, INCOMPATIBLE_SKETCH, or CAPACITY_EXCEEDED.

merge
(
const other: StringSplitBlockBloomFilter
other
) // union in place; `other` is untouched
const
const smaller: StringSplitBlockBloomFilter
smaller
=
const shard: StringSplitBlockBloomFilter
shard
.
StringSplitBlockBloomFilter.reduce: (targetBlockCount: number) => StringSplitBlockBloomFilter

Return a new filter folded to a power-of-two block count no larger than this one.

@throws ― {ScalarSketchInvalidInputError} With INVALID_REDUCTION for an unsound target.

reduce
(
const shard: StringSplitBlockBloomFilter
shard
.
SplitBlockBloomFilterMetadata.blockCount: number

Effective number of 256-bit blocks. Always a power of two.

blockCount
/ 2) // half the state, a higher error model
const
const restored: ScalarSketch
restored
=
function deserializeScalarSketch(value: unknown): ScalarSketch

Deserialize exact state from untrusted canonical binary bytes. Shared envelope geometry, family dimensions, and state invariants are checked before mutable typed state is allocated.

@throws ― {ScalarSketchParseError} For malformed envelopes, unsupported scalar-sketch versions, unknown discriminants, or invalid family state.

@throws ― {HashParseError} From knotkit/hash for invalid hash identities.

deserializeScalarSketch
(
function serializeScalarSketch(sketch: ScalarSketch, options?: SerializeScalarSketchOptions): Uint8Array

Serialize exact scalar-sketch state into canonical binary bytes.

@throws ― {ScalarSketchInvalidInputError} With FOREIGN_STRUCTURE, WRONG_FAMILY, or STATE_TOO_LARGE when the value cannot be serialized.

serializeScalarSketch
(
const smaller: StringSplitBlockBloomFilter
smaller
))
if (
const restored: ScalarSketch
restored
.
kind: "split-block-bloom-filter" | "hyperloglog" | "count-min-sketch" | "minhash"
kind
=== 'split-block-bloom-filter' &&
const restored: StringSplitBlockBloomFilter | BytesSplitBlockBloomFilter | Uint32SplitBlockBloomFilter | Uint64SplitBlockBloomFilter
restored
.
scalarKind: "string" | "bytes" | "uint32" | "uint64"
scalarKind
=== 'string') {
const restored: StringSplitBlockBloomFilter
restored
.
StringSplitBlockBloomFilter.mightContain: (value: string) => boolean

Return false for a definite miss and true for a possible member. O(length).

@throws ― {HashInvalidInputError} From knotkit/hash for an invalid string.

mightContain
('alpha') // true
}
  • count distinct visitors without storing every visitor
  • check whether an id or URL was already processed, with a small false-positive rate and no false negatives
  • find the heavy hitters of a stream without keeping a counter per key
  • estimate how much two large sets overlap without holding both of them
  • answer those questions per partition and merge the answers afterwards
  • keep the answer in a fixed-size summary that is serialized now and queried later
FactoryChoose whenCost
stringSplitBlockBloomFilter
kind split-block-bloom-filter
the question is membership, a rare false positive is acceptable, and `expectedEntries` is known before the first update; the `string`, `bytes`, `uint32`, and `uint64` factories are this one layout over four value domains`blockCount` 256-bit blocks, a power of two, 16 KiB at `expectedEntries` 10,000 and a 0.01 target rate; one block touched per update
stringHyperLogLog
kind hyperloglog
the question is how many distinct values there are, the reported `relativeStandardError` of `1.04 / sqrt(registerCount)` is acceptable, and the values themselves need not be retained; the four domain factories differ only in how a value is hashedone byte per register over `2 ** precision` registers, 16 KiB at the default precision 14 for a 0.8% relative standard error
stringCountMinSketch
kind count-min-sketch
the question is how often each value occurred, an overestimate is acceptable, and the reported `epsilon` and `confidence` bounds fit the caller's tolerance; the four domain factories differ only in how a value is hashed`width * depth` 32-bit counters, 4096 columns and 5 rows at the default `epsilon` 0.001 and `confidence` 0.99, 80 KiB
stringMinHash
kind minhash
the question is how much two sets overlap, as an estimated Jaccard index, one signature per set fits where the sets do not, and `maximumStandardError` of `1 / (2 * sqrt(signatureSize))` is acceptable`signatureSize` 64-bit coordinate minima, 1 KiB at the default 128 coordinates, and one digest per coordinate per value
string*
kind string
values are JavaScript strings and the caller accepts O(length) hashing per operation, which every string-domain sketch pays on `update` and on the query that takes a valueone XXH64 digest over the UTF-8 bytes, so time and cache pressure scale with string length rather than with state size
bytes*
kind bytes
values are `Uint8Array` byte sequences, such as digests or serialized records, and hashing those exact bytes is what the caller wantsone XXH64 digest over the raw bytes, O(length) per operation
uint32*
kind uint32
values are integers in `0..2^32 - 1`, so every operation hashes in O(1) with no encoding stepone XXH64 digest of four bytes per operation, independent of state size
uint64*
kind uint64
values are `bigint`s in `0n..2^64 - 1n`, so every operation hashes in O(1) and the full 64-bit domain survivesone XXH64 digest of eight bytes per operation, independent of state size

Performance and benchmarks for this module

{"v":1,"box":[59.2899,94.1597,913.7333,437.3555],"x":{"s":"linear","lim":[442.88,2117.12],"inv":false,"g":0,"t":"Distinct inserted IDs","tk":[[512,"512"],[1024,"1,024"],[1536,"1,536"],[2048,"2,048"]]},"y":{"s":"log","lim":[0.00259957885018,4.50668772184],"inv":false,"g":0,"tk":[[0.01,"0.01"],[0.1,"0.1"],[1,"1"]],"b":10},"ti":"At its 1,024-ID design load the filter runs at 0.14%; it passes 1% at 1.6× load","a":[{"k":"line","c":"#5b6b7c","s":"x","d":[512,0.00353688792868,640,0.0114122818403,768,0.0296350493105,896,0.0658802261236,1024,0.130293962204,1152,0.235215940312,1280,0.39466055208,1408,0.623634358143,1536,0.937374930745,1664,1.35058986253,1792,1.87676002726,1920,2.52755280725,2048,3.31237243653],"p":[94.57,423.19,159.89,369.28,225.21,325.37,290.54,288.6,355.86,257.22,421.19,230.04,486.51,206.23,551.84,185.17,617.16,166.42,682.48,149.61,747.81,134.47,813.13,120.77,878.46,108.33]},{"k":"scatter","c":"#1d5fa6","s":"xy","d":[512,0.006103515625,640,0.01220703125,768,0.0213623046875,896,0.0701904296875,1024,0.143432617188,1152,0.259399414063,1280,0.433349609375,1408,0.637817382813,1536,0.933837890625,1664,1.34887695313,1792,1.89208984375,1920,2.57568359375,2048,3.29284667969],"p":[94.57,398.08,159.89,366.18,225.21,340.43,290.54,285.69,355.86,252.8,421.19,225.54,486.51,201.92,551.84,184.14,617.16,166.59,682.48,149.67,747.81,134.1,813.13,119.9,878.46,108.6],"r":4.96},{"k":"segments","c":"#8c8c84"},{"k":"segments","c":"#8c8c84"},{"k":"line","c":"#8c8c84"},{"k":"annotation","c":"#5c5c57"},{"k":"line","c":"#8c8c84"},{"k":"annotation","c":"#5c5c57"},{"k":"annotation","c":"#5c5c57"},{"k":"annotation","c":"#5b6b7c"},{"k":"annotation","c":"#1d5fa6"}],"lg":[]} 512 1,024 1,536 2,048 Distinct inserted IDs 0.01 0.1 1 design load 1% target False positive rate over 32,768 absent IDs (%) Filter model Observed At its 1,024-ID design load the filter runs at 0.14%; it passes 1% at 1.6× load
{"v":1,"box":[59.2899,122.3921,462.5675,437.3555],"x":{"s":"linear","lim":[442.88,2117.12],"inv":false,"g":0,"t":"Distinct inserted IDs","tk":[[512,"512"],[1024,"1,024"],[1536,"1,536"],[2048,"2,048"]]},"y":{"s":"log","lim":[0.00259957885018,4.50668772184],"inv":false,"g":0,"tk":[[0.01,"0.01"],[0.1,"0.1"],[1,"1"]],"b":10},"ti":"At its 1,024-ID design load the filter\nruns at 0.14%; it passes 1% at 1.6× load","a":[{"k":"line","c":"#5b6b7c","s":"x","d":[512,0.00353688792868,640,0.0114122818403,768,0.0296350493105,896,0.0658802261236,1024,0.130293962204,1152,0.235215940312,1280,0.39466055208,1408,0.623634358143,1536,0.937374930745,1664,1.35058986253,1792,1.87676002726,1920,2.52755280725,2048,3.31237243653],"p":[75.94,424.35,106.77,374.88,137.6,334.58,168.43,300.84,199.27,272.04,230.1,247.09,260.93,225.24,291.76,205.92,322.59,188.71,353.42,173.28,384.26,159.39,415.09,146.82,445.92,135.4]},{"k":"scatter","c":"#1d5fa6","s":"xy","d":[512,0.006103515625,640,0.01220703125,768,0.0213623046875,896,0.0701904296875,1024,0.143432617188,1152,0.259399414063,1280,0.433349609375,1408,0.637817382813,1536,0.933837890625,1664,1.34887695313,1792,1.89208984375,1920,2.57568359375,2048,3.29284667969],"p":[75.94,401.31,106.77,372.04,137.6,348.4,168.43,298.17,199.27,267.98,230.1,242.96,260.93,221.29,291.76,204.97,322.59,188.87,353.42,173.34,384.26,159.04,415.09,146.02,445.92,135.64],"r":4.96},{"k":"segments","c":"#8c8c84"},{"k":"segments","c":"#8c8c84"},{"k":"line","c":"#8c8c84"},{"k":"annotation","c":"#5c5c57"},{"k":"line","c":"#8c8c84"},{"k":"annotation","c":"#5c5c57"},{"k":"annotation","c":"#5c5c57"},{"k":"annotation","c":"#5b6b7c"},{"k":"annotation","c":"#1d5fa6"}],"lg":[]} 512 1,024 1,536 2,048 Distinct inserted IDs 0.01 0.1 1 design load 1% target False positive rate over 32,768 absent IDs (%) Filter model Observed At its 1,024-ID design load the filter runs at 0.14%; it passes 1% at 1.6× load
{"v":1,"box":[79.2431,94.1597,884.3333,444.3555],"x":{"s":"log","lim":[25.7232317038,5095.47173191],"inv":false,"g":0,"t":"True distinct IDs (each inserted twice)","tk":[[32,"32"],[64,"64"],[128,"128"],[256,"256"],[512,"512"],[1024,"1,024"],[2048,"2,048"],[4096,"4,096"]],"b":10},"y":{"s":"linear","lim":[-17.3284845397,17.3284845397],"inv":false,"g":0,"tk":[[-15,"−15%"],[-6.5,"−6.5%"],[6.5,"6.5%"],[0,"0"],[15,"15%"]]},"ti":"256 registers: 78% of estimates within ±6.5%","a":[{"k":"scatter","c":"#1d5fa6","s":"xy","d":[32,6.74958598064,64,6.66032136815,128,6.05506326903,256,-0.465535881387,512,-6.08347628882,1024,-5.52200532964,2048,-3.07543201618,4096,-5.48650779242,32,-3.82304054962,64,-1.39469859287,128,8.26459592581,256,1.84583180824,512,6.92008264887,1024,10.0749107785,2048,3.93938569747,4096,-1.80251942202,32,-7.34869384522,64,-7.13084360724,128,-7.8318226049,256,-8.11645486529,512,-1.02818203795,1024,-2.56109670927,2048,-0.050253499409,4096,-3.074939093,32,3.18751481479,64,0.805240712161,128,1.55097465568,256,4.29893718525,512,6.58475604,1024,5.29074649826,2048,2.34843654911,4096,-3.46582992179,32,-0.208227492003,64,-3.01458544746,128,-0.307286124054,256,-7.19086708579,512,-7.50719620741,1024,3.2603655433,2048,0.0427804379843,4096,0.229136436891,32,-7.28878901973,64,0.827681334955,128,-2.24811455378,256,0.457174501359,512,11.8667890585,1024,6.27953033316,2048,-1.35480275888,4096,6.72287405785,32,3.23089017408,64,10.8157924047,128,11.6407752185,256,3.10974715709,512,1.4641985583,1024,4.02684787182,2048,3.60453456612,4096,-1.01088615313,32,3.18582560346,64,-1.48254522038,128,-1.00766499803,256,-3.28150461298,512,-2.11244215399,1024,-0.943045904187,2048,-2.07711518974,4096,-5.88493766237,32,-0.23257815319,64,-3.06455099481,128,-1.38016986815,256,3.94086495691,512,8.39164384301,1024,-2.3693577307,2048,-2.3789141223,4096,4.28532200169,32,-7.36968478873,64,-7.2203805326,128,-7.28820041888,256,-2.57977627327,512,-3.58000553706,1024,-7.92019731212,2048,4.73614724192,4096,4.0801195479,32,-7.33234836294,64,-9.30839817604,128,-1.22484214619,256,-0.929647810095,512,0.495205948722,1024,1.70157920994,2048,-4.77484403573,4096,-0.0851090049571,32,-7.33961373369,64,-3.16755098372,128,-5.39481335182,256,-6.13864130546,512,-6.80186004788,1024,-5.6366339848,2048,-11.4250335385,4096,-3.44118323526,32,3.22863601072,64,12.6891802385,128,7.85795605439,256,2.81369373136,512,-6.03385230624,1024,-4.61431627636,2048,-4.4776878277,4096,-5.61105511715,32,-0.161071898379,64,-3.0869069448,128,2.03592358107,256,4.55844914034,512,9.47444571126,1024,9.79261797429,2048,14.6438008278,4096,5.40637264596,32,-3.81399009875,64,-3.18936382309,128,-0.836354678013,256,-3.83765762105,512,2.21641848838,1024,-3.34915950553,2048,3.15859427049,4096,0.551379559395,32,6.84428220689,64,6.72654050873,128,2.8887819178,256,9.04459415698,512,8.46210061779,1024,-0.250625119881,2048,-0.556950924821,4096,-4.94011562235,32,-3.78168812108,64,-3.14175949745,128,2.97787102233,256,-0.415597040643,512,1.96041051697,1024,0.321926360537,2048,4.93142689052,4096,-0.828145965198,32,3.34710399933,64,8.83189537618,128,2.81196846115,256,-5.0297248998,512,-8.5516553567,1024,-5.21843809909,2048,3.3909047053,4096,0.0416226472302,32,-0.21882478093,64,-1.07034381659,128,6.06687211946,256,1.86009564046,512,6.10167460701,1024,6.57518422598,2048,-0.934653318351,4096,3.05571115559,32,-3.75034426485,64,2.73935231926,128,0.382023540595,256,-1.53324183275,512,1.66043117128,1024,15.4408806246,2048,6.15669701869,4096,-4.89248393242,32,6.74250559368,64,-1.43324709549,128,-1.77792618734,256,-7.06440763609,512,-6.65310527642,1024,4.96280623231,2048,0.32731557693,4096,-3.17022838096,32,-0.206153846094,64,2.88070113344,128,-4.71696992629,256,-6.47167050997,512,2.48006496223,1024,4.66887502742,2048,6.3023084444,4096,-1.77191368702,32,-0.306610079783,64,-1.07538986018,128,-5.82873221396,256,-6.86997352635,512,-2.01337487851,1024,-1.75778024322,2048,-6.09245678276,4096,10.8143459734,32,-3.81209418044,64,-7.24029210473,128,2.91145979098,256,3.59724675963,512,1.39914489569,1024,5.24326163476,2048,-6.73486649276,4096,-9.70963157521,32,3.24836327868,64,2.71228679178,128,2.93919077128,256,6.39152548425,512,-1.75655945461,1024,2.62603706063,2048,-2.17343060136,4096,-3.95235410748,32,3.3143634825,64,-1.00197745219,128,1.56597428627,256,4.51569000439,512,-0.829508383537,1024,-0.247467928589,2048,7.6077371844,4096,-3.50683875179,32,6.90241953835,64,0.874072360418,128,-2.92308620807,256,-6.4488586854,512,-1.90010616369,1024,-6.16897154366,2048,-5.32182870563,4096,-0.68647486429,32,6.97438594743,64,7.14652990669,128,10.4396549785,256,16.5033186093,512,5.72723187708,1024,2.44030715107,2048,5.11801267546,4096,4.76269390175,32,-7.26690871992,64,-1.17207087131,128,3.04857958329,256,2.77207232319,512,-2.89893690851,1024,-1.12226122306,2048,1.90388458936,4096,7.04972962535,32,-3.90148789975,64,-1.37464145306,128,-0.0876318368951,256,0.013302737898,512,-2.6641471513,1024,2.2368055068,2048,1.23984658482,4096,3.18828862054,32,-3.85213721226,64,0.613225011081,128,0.394014717795,256,-0.70372897634,512,0.180413064936,1024,1.50729452826,2048,0.650927962037,4096,6.32741301331,32,-3.82872678595,64,-3.1894877316,128,-6.12209907395,256,1.37618651296,512,-2.46989189905,1024,1.34211707545,2048,0.331307962381,4096,0.864065671735],"p":[112.48,201.06,218,201.96,323.51,208.07,429.03,273.96,534.55,330.73,640.06,325.06,745.58,300.33,851.1,324.7,112.48,307.89,218,283.35,323.51,185.75,429.03,250.61,534.55,199.33,640.06,167.45,745.58,229.45,851.1,287.47,112.48,343.51,218,341.31,323.51,348.4,429.03,351.27,534.55,279.65,640.06,295.14,745.58,269.77,851.1,300.33,112.48,237.05,218,261.12,323.51,253.59,429.03,225.82,534.55,202.72,640.06,215.8,745.58,245.53,851.1,304.28,112.48,271.36,218,299.72,323.51,272.36,429.03,341.92,534.55,345.12,640.06,236.31,745.58,268.83,851.1,266.94,112.48,342.91,218,260.89,323.51,291.97,429.03,264.64,534.55,149.35,640.06,205.81,745.58,282.95,851.1,201.33,112.48,236.61,218,159.97,323.51,151.63,429.03,237.83,534.55,254.46,640.06,228.57,745.58,232.84,851.1,279.47,112.48,237.07,218,284.24,323.51,279.44,429.03,302.42,534.55,290.6,640.06,278.79,745.58,290.25,851.1,328.72,112.48,271.61,218,300.22,323.51,283.2,429.03,229.44,534.55,184.46,640.06,293.2,745.58,293.3,851.1,225.96,112.48,343.73,218,342.22,323.51,342.9,429.03,295.33,534.55,305.43,640.06,349.29,745.58,221.4,851.1,228.03,112.48,343.35,218,363.32,323.51,281.63,429.03,278.65,534.55,264.25,640.06,252.06,745.58,317.51,851.1,270.12,112.48,343.42,218,301.26,323.51,323.77,429.03,331.29,534.55,337.99,640.06,326.21,745.58,384.7,851.1,304.03,112.48,236.63,218,141.04,323.51,189.86,429.03,240.83,534.55,330.23,640.06,315.88,745.58,314.5,851.1,325.96,112.48,270.89,218,300.45,323.51,248.69,429.03,223.2,534.55,173.52,640.06,170.31,745.58,121.29,851.1,214.63,112.48,307.8,218,301.48,323.51,277.71,429.03,308.04,534.55,246.86,640.06,303.1,745.58,237.34,851.1,263.69,112.48,200.1,218,201.29,323.51,240.07,429.03,177.87,534.55,183.75,640.06,271.79,745.58,274.89,851.1,319.18,112.48,307.47,218,301,323.51,239.17,429.03,273.46,534.55,249.45,640.06,266,745.58,219.43,851.1,277.63,112.48,235.44,218,180.01,323.51,240.84,429.03,320.08,534.55,355.67,640.06,321.99,745.58,234.99,851.1,268.84,112.48,271.47,218,280.07,323.51,207.95,429.03,250.46,534.55,207.6,640.06,202.82,745.58,278.7,851.1,238.38,112.48,307.15,218,241.58,323.51,265.4,429.03,284.75,534.55,252.48,640.06,113.23,745.58,207.05,851.1,318.69,112.48,201.13,218,283.74,323.51,287.22,429.03,340.64,534.55,336.48,640.06,219.11,745.58,265.95,851.1,301.29,112.48,271.34,218,240.15,323.51,316.92,429.03,334.65,534.55,244.2,640.06,222.08,745.58,205.58,851.1,287.16,112.48,272.36,218,280.12,323.51,328.15,429.03,338.68,534.55,289.6,640.06,287.02,745.58,330.82,851.1,159.98,112.48,307.78,218,342.42,323.51,239.84,429.03,232.91,534.55,255.12,640.06,216.28,745.58,337.31,851.1,367.37,112.48,236.43,218,241.85,323.51,239.56,429.03,204.67,534.55,287.01,640.06,242.72,745.58,291.22,851.1,309.19,112.48,235.77,218,279.38,323.51,253.43,429.03,223.63,534.55,277.64,640.06,271.76,745.58,192.38,851.1,304.69,112.48,199.51,218,260.43,323.51,298.79,429.03,334.42,534.55,288.46,640.06,331.59,745.58,323.03,851.1,276.19,112.48,198.78,218,197.04,323.51,163.77,429.03,102.5,534.55,211.39,640.06,244.6,745.58,217.54,851.1,221.13,112.48,342.69,218,281.1,323.51,238.45,429.03,241.25,534.55,298.55,640.06,280.6,745.58,250.02,851.1,198.02,112.48,308.68,218,283.15,323.51,270.14,429.03,269.12,534.55,296.18,640.06,246.66,745.58,256.73,851.1,237.04,112.48,308.18,218,263.06,323.51,265.28,429.03,276.37,534.55,267.43,640.06,254.03,745.58,262.68,851.1,205.32,112.48,307.95,218,301.49,323.51,331.12,429.03,255.35,534.55,294.21,640.06,255.7,745.58,265.91,851.1,260.53],"r":3.07},{"k":"segments","c":"#8c8c84"},{"k":"segments","c":"#8c8c84"},{"k":"fill","c":"#5b6b7c"},{"k":"annotation","c":"#5c5c57"},{"k":"annotation","c":"#5b6b7c"}],"lg":[]} 32 64 128 256 512 1,024 2,048 4,096 True distinct IDs (each inserted twice) −15% −6.5% 6.5% 0 15% Relative error of 32 seeded runs (%) ±1.04/√m = 6.5% 256 registers: 78% of estimates within ±6.5% {"v":1,"box":[79.2431,605.1597,884.3333,955.3555],"x":{"s":"log","lim":[25.7232317038,5095.47173191],"inv":false,"g":1,"t":"True distinct IDs (each inserted twice)","tk":[[32,"32"],[64,"64"],[128,"128"],[256,"256"],[512,"512"],[1024,"1,024"],[2048,"2,048"],[4096,"4,096"]],"b":10},"y":{"s":"linear","lim":[-17.3284845397,17.3284845397],"inv":false,"g":1,"tk":[[-15,"−15%"],[0,"0"],[15,"15%"]]},"ti":"4,096 registers: 91% of estimates within ±1.6%","a":[{"k":"scatter","c":"#1d5fa6","s":"xy","d":[32,0.392210320842,64,-0.798344243261,128,0.790219228356,256,-0.0576279188209,512,-0.264561463607,1024,-0.949568980658,2048,-0.179003636184,4096,-0.454290265055,32,0.392208499114,64,0.788973643162,128,1.59685384812,256,0.770062905108,512,0.398684378234,1024,0.837172211756,2048,0.00162467467071,4096,-0.68830330918,32,0.392012793811,64,0.788587658337,128,0.788268695194,256,0.342801097553,512,-0.308030798828,1024,-2.28872135907,2048,-0.440720236853,4096,1.0326616052,32,0.391835826907,64,-0.798590730295,128,0.790784781675,256,0.343970029922,512,1.47359108703,1024,0.215817956371,2048,0.784660294312,4096,-1.0090979754,32,0.391864974355,64,-2.38481554458,128,-0.0168197165914,256,-0.492321013428,512,-0.0825424275008,1024,-0.599027140305,2048,-0.163612409729,4096,0.00138522411739,32,0.39182333515,64,0.788390404576,128,0.784269236626,256,0.349548833191,512,2.59290263566,1024,0.990336546102,2048,0.63566982071,4096,0.644107537079,32,0.391966990553,64,0.788352632667,128,0.787282440353,256,-0.484945598626,512,-0.723690645829,1024,-1.43219283216,2048,-0.880494364062,4096,0.0955779943585,32,0.391668229415,64,-0.798736080838,128,0.787211095007,256,-1.32200200048,512,-0.318689006277,1024,-2.05168403551,2048,-1.41048740056,4096,-0.0313636633339,32,0.39175254858,64,-0.798473839689,128,-0.018291555555,256,0.762786064484,512,0.397238280626,1024,-0.357803931623,2048,-0.797559123237,4096,-0.545577895732,32,0.392201212201,64,0.788917115808,128,0.787135552986,256,2.0109075167,512,1.24110190437,1024,0.502394457808,2048,-0.43976401181,4096,-1.52268903751,32,0.392019039714,64,0.790386060679,128,0.793473082938,256,-1.3021592635,512,0.401723505302,1024,0.215064858392,2048,0.414822984976,4096,0.383356456199,32,0.392643633851,64,0.790178307305,128,0.79074910651,256,-0.483075234042,512,-0.954409294257,1024,-0.0482580880456,2048,-0.400932345133,4096,-0.795834960354,32,0.391794187727,64,0.788025277311,128,1.59319532254,256,0.34893309589,512,-0.503555984624,1024,0.121439641378,2048,-0.152716098892,4096,-0.293676161424,32,0.392025285616,64,0.789431241642,128,-0.822285281699,256,-0.484867859962,512,1.26340445684,1024,-0.084150178079,2048,0.452788016424,4096,1.0573313333,32,0.391851441609,64,0.787557330719,128,0.786195483973,256,0.752513124835,512,0.814717771114,1024,-1.89187319898,2048,-0.29365059046,4096,0.999588937304,32,0.39210179799,64,-2.38588731914,128,-2.43412921247,256,-0.0669534329579,512,0.187173654358,1024,0.174432535615,2048,-1.67475983159,4096,-0.520057642659,32,0.392002383976,64,-0.798465708159,128,-0.0163364937894,256,0.338965859487,512,0.568910321433,1024,-0.274103893471,2048,-0.252198705582,4096,-0.985624304118,32,0.391810322905,64,0.788590806009,128,-0.824207428188,256,-1.73328824421,512,-0.279896309758,1024,-1.24803961346,2048,-0.46356998376,4096,-0.415555931844,32,0.392080457792,64,-0.797841609203,128,-0.824053009023,256,-1.31744377089,512,1.94217943443,1024,1.11625617713,2048,-0.810592750757,4096,1.04863653077,32,0.391519369999,64,0.787190111101,128,0.785805192615,256,0.754199098013,512,-1.41594091285,1024,-1.05632949841,2048,0.31876984667,4096,1.66158054339,32,0.391746302711,64,0.788562476962,128,-0.0179678682759,256,-0.0645025593442,512,0.372447674456,1024,-0.434864342455,2048,1.03468292043,4096,-0.608036475992,32,0.392000302009,64,0.788688383959,128,0.788859932748,256,0.346134290655,512,-0.710589050904,1024,-0.947327405711,2048,-1.6664331056,4096,-0.626901163149,32,0.392366729491,64,-2.38450453855,128,-1.62524206816,256,-0.482935605974,512,-0.939486965749,1024,1.14429488226,2048,-0.976874942837,4096,-0.723115216925,32,0.391948252868,64,0.788589756785,128,-0.0186121432824,256,-0.48941639035,512,0.130088050219,1024,0.588079919814,2048,-0.0317262024741,4096,-0.371695601724,32,0.392202253188,64,0.789353597813,128,0.786762041323,256,1.17046002044,512,0.802876725941,1024,-0.00113086916131,2048,0.745942668431,4096,0.986951695126,32,0.391969072518,64,0.788524704925,128,-0.822610385706,256,0.346461901929,512,-0.061864830123,1024,0.492980834888,2048,0.529762518222,4096,1.17860732898,32,0.392014875779,64,0.78897587278,128,-0.0172936421103,256,-0.0613397644727,512,0.620480050342,1024,-0.853518474632,2048,-3.08928905013,4096,-0.70284732071,32,0.392687355732,64,-0.796666574225,128,-0.0118303195557,256,1.19278857016,512,0.85598635235,1024,1.91670793722,2048,1.29763907196,4096,1.35935934298,32,0.392073170898,64,0.789359893254,128,0.790262247959,256,0.766404164742,512,0.177172121297,1024,0.562535397102,2048,-0.512234034335,4096,-1.66677424175,32,0.392166859624,64,0.79058122372,128,0.791638369993,256,-0.0553313470657,512,-0.274070281172,1024,0.39175145407,2048,0.321733982477,4096,-0.62139164682,32,0.39231363898,64,-2.38470728321,128,-1.62878041636,256,-0.481920861284,512,-0.522300899176,1024,1.21739169068,2048,-1.70045413793,4096,-1.36040571138,32,-2.75722604566,64,-0.798994254878,128,-2.43803432255,256,-1.31972293832,512,0.361547764034,1024,-0.573219880673,2048,-1.2237313909,4096,0.609620179051],"p":[112.48,776.29,218,788.32,323.51,772.27,429.03,780.84,534.55,782.93,640.06,789.85,745.58,782.07,851.1,784.85,112.48,776.29,218,772.29,323.51,764.12,429.03,772.48,534.55,776.23,640.06,771.8,745.58,780.24,851.1,787.21,112.48,776.3,218,772.29,323.51,772.29,429.03,776.79,534.55,783.37,640.06,803.38,745.58,784.71,851.1,769.82,112.48,776.3,218,788.33,323.51,772.27,429.03,776.78,534.55,765.37,640.06,778.08,745.58,772.33,851.1,790.45,112.48,776.3,218,804.36,323.51,780.43,429.03,785.23,534.55,781.09,640.06,786.31,745.58,781.91,851.1,780.24,112.48,776.3,218,772.29,323.51,772.33,429.03,776.73,534.55,754.06,640.06,770.25,745.58,773.83,851.1,773.75,112.48,776.3,218,772.29,323.51,772.3,429.03,785.16,534.55,787.57,640.06,794.73,745.58,789.15,851.1,779.29,112.48,776.3,218,788.33,323.51,772.3,429.03,793.62,534.55,783.48,640.06,800.99,745.58,794.51,851.1,780.57,112.48,776.3,218,788.33,323.51,780.44,429.03,772.55,534.55,776.24,640.06,783.87,745.58,788.32,851.1,785.77,112.48,776.29,218,772.29,323.51,772.3,429.03,759.94,534.55,767.72,640.06,775.18,745.58,784.7,851.1,795.64,112.48,776.3,218,772.27,323.51,772.24,429.03,793.42,534.55,776.2,640.06,778.08,745.58,776.07,851.1,776.38,112.48,776.29,218,772.27,323.51,772.27,429.03,785.14,534.55,789.9,640.06,780.75,745.58,784.31,851.1,788.3,112.48,776.3,218,772.29,323.51,764.16,429.03,776.73,534.55,785.35,640.06,779.03,745.58,781.8,851.1,783.23,112.48,776.3,218,772.28,323.51,788.57,429.03,785.16,534.55,767.49,640.06,781.11,745.58,775.68,851.1,769.57,112.48,776.3,218,772.3,323.51,772.31,429.03,772.65,534.55,772.03,640.06,799.37,745.58,783.22,851.1,770.16,112.48,776.3,218,804.37,323.51,804.85,429.03,780.93,534.55,778.37,640.06,778.5,745.58,797.18,851.1,785.51,112.48,776.3,218,788.33,323.51,780.42,429.03,776.83,534.55,774.51,640.06,783.03,745.58,782.81,851.1,790.22,112.48,776.3,218,772.29,323.51,788.59,429.03,797.77,534.55,783.09,640.06,792.87,745.58,784.94,851.1,784.46,112.48,776.3,218,788.32,323.51,788.58,429.03,793.57,534.55,760.63,640.06,768.98,745.58,788.45,851.1,769.66,112.48,776.3,218,772.3,323.51,772.32,429.03,772.64,534.55,794.57,640.06,790.93,745.58,777.04,851.1,763.47,112.48,776.3,218,772.29,323.51,780.44,429.03,780.91,534.55,776.49,640.06,784.65,745.58,769.8,851.1,786.4,112.48,776.3,218,772.29,323.51,772.29,429.03,776.76,534.55,787.44,640.06,789.83,745.58,797.1,851.1,786.59,112.48,776.29,218,804.35,323.51,796.68,429.03,785.14,534.55,789.75,640.06,768.69,745.58,790.13,851.1,787.56,112.48,776.3,218,772.29,323.51,780.45,429.03,785.2,534.55,778.94,640.06,774.32,745.58,780.58,851.1,784.01,112.48,776.29,218,772.28,323.51,772.31,429.03,768.43,534.55,772.14,640.06,780.27,745.58,772.72,851.1,770.28,112.48,776.3,218,772.29,323.51,788.57,429.03,776.76,534.55,780.88,640.06,775.28,745.58,774.9,851.1,768.35,112.48,776.3,218,772.29,323.51,780.43,429.03,780.88,534.55,773.99,640.06,788.88,745.58,811.47,851.1,787.36,112.48,776.29,218,788.31,323.51,780.38,429.03,768.2,534.55,771.61,640.06,760.89,745.58,767.15,851.1,766.52,112.48,776.3,218,772.28,323.51,772.27,429.03,772.51,534.55,778.47,640.06,774.57,745.58,785.43,851.1,797.1,112.48,776.29,218,772.27,323.51,772.26,429.03,780.82,534.55,783.03,640.06,776.3,745.58,777.01,851.1,786.54,112.48,776.29,218,804.35,323.51,796.72,429.03,785.13,534.55,785.54,640.06,767.96,745.58,797.44,851.1,794,112.48,808.12,218,788.33,323.51,804.89,429.03,793.59,534.55,776.6,640.06,786.05,745.58,792.62,851.1,774.1],"r":3.07},{"k":"segments","c":"#8c8c84"},{"k":"segments","c":"#8c8c84"},{"k":"fill","c":"#5b6b7c"},{"k":"annotation","c":"#5c5c57"},{"k":"annotation","c":"#5b6b7c"}],"lg":[]} 32 64 128 256 512 1,024 2,048 4,096 True distinct IDs (each inserted twice) −15% 0 15% Relative error of 32 seeded runs (%) ±1.04/√m = 1.6% 4,096 registers: 91% of estimates within ±1.6%
{"v":1,"box":[79.2431,122.3921,433.355,444.3555],"x":{"s":"log","lim":[25.7232317038,5095.47173191],"inv":false,"g":0,"t":"True distinct IDs (each inserted twice)","tk":[[32,"32"],[64,"64"],[128,"128"],[256,"256"],[512,"512"],[1024,"1,024"],[2048,"2,048"],[4096,"4,096"]],"b":10},"y":{"s":"linear","lim":[-17.3284845397,17.3284845397],"inv":false,"g":0,"tk":[[-15,"−15%"],[-6.5,"−6.5%"],[6.5,"6.5%"],[0,"0"],[15,"15%"]]},"ti":"256 registers: 78% of estimates within\n±6.5%","a":[{"k":"scatter","c":"#1d5fa6","s":"xy","d":[32,6.74958598064,64,6.66032136815,128,6.05506326903,256,-0.465535881387,512,-6.08347628882,1024,-5.52200532964,2048,-3.07543201618,4096,-5.48650779242,32,-3.82304054962,64,-1.39469859287,128,8.26459592581,256,1.84583180824,512,6.92008264887,1024,10.0749107785,2048,3.93938569747,4096,-1.80251942202,32,-7.34869384522,64,-7.13084360724,128,-7.8318226049,256,-8.11645486529,512,-1.02818203795,1024,-2.56109670927,2048,-0.050253499409,4096,-3.074939093,32,3.18751481479,64,0.805240712161,128,1.55097465568,256,4.29893718525,512,6.58475604,1024,5.29074649826,2048,2.34843654911,4096,-3.46582992179,32,-0.208227492003,64,-3.01458544746,128,-0.307286124054,256,-7.19086708579,512,-7.50719620741,1024,3.2603655433,2048,0.0427804379843,4096,0.229136436891,32,-7.28878901973,64,0.827681334955,128,-2.24811455378,256,0.457174501359,512,11.8667890585,1024,6.27953033316,2048,-1.35480275888,4096,6.72287405785,32,3.23089017408,64,10.8157924047,128,11.6407752185,256,3.10974715709,512,1.4641985583,1024,4.02684787182,2048,3.60453456612,4096,-1.01088615313,32,3.18582560346,64,-1.48254522038,128,-1.00766499803,256,-3.28150461298,512,-2.11244215399,1024,-0.943045904187,2048,-2.07711518974,4096,-5.88493766237,32,-0.23257815319,64,-3.06455099481,128,-1.38016986815,256,3.94086495691,512,8.39164384301,1024,-2.3693577307,2048,-2.3789141223,4096,4.28532200169,32,-7.36968478873,64,-7.2203805326,128,-7.28820041888,256,-2.57977627327,512,-3.58000553706,1024,-7.92019731212,2048,4.73614724192,4096,4.0801195479,32,-7.33234836294,64,-9.30839817604,128,-1.22484214619,256,-0.929647810095,512,0.495205948722,1024,1.70157920994,2048,-4.77484403573,4096,-0.0851090049571,32,-7.33961373369,64,-3.16755098372,128,-5.39481335182,256,-6.13864130546,512,-6.80186004788,1024,-5.6366339848,2048,-11.4250335385,4096,-3.44118323526,32,3.22863601072,64,12.6891802385,128,7.85795605439,256,2.81369373136,512,-6.03385230624,1024,-4.61431627636,2048,-4.4776878277,4096,-5.61105511715,32,-0.161071898379,64,-3.0869069448,128,2.03592358107,256,4.55844914034,512,9.47444571126,1024,9.79261797429,2048,14.6438008278,4096,5.40637264596,32,-3.81399009875,64,-3.18936382309,128,-0.836354678013,256,-3.83765762105,512,2.21641848838,1024,-3.34915950553,2048,3.15859427049,4096,0.551379559395,32,6.84428220689,64,6.72654050873,128,2.8887819178,256,9.04459415698,512,8.46210061779,1024,-0.250625119881,2048,-0.556950924821,4096,-4.94011562235,32,-3.78168812108,64,-3.14175949745,128,2.97787102233,256,-0.415597040643,512,1.96041051697,1024,0.321926360537,2048,4.93142689052,4096,-0.828145965198,32,3.34710399933,64,8.83189537618,128,2.81196846115,256,-5.0297248998,512,-8.5516553567,1024,-5.21843809909,2048,3.3909047053,4096,0.0416226472302,32,-0.21882478093,64,-1.07034381659,128,6.06687211946,256,1.86009564046,512,6.10167460701,1024,6.57518422598,2048,-0.934653318351,4096,3.05571115559,32,-3.75034426485,64,2.73935231926,128,0.382023540595,256,-1.53324183275,512,1.66043117128,1024,15.4408806246,2048,6.15669701869,4096,-4.89248393242,32,6.74250559368,64,-1.43324709549,128,-1.77792618734,256,-7.06440763609,512,-6.65310527642,1024,4.96280623231,2048,0.32731557693,4096,-3.17022838096,32,-0.206153846094,64,2.88070113344,128,-4.71696992629,256,-6.47167050997,512,2.48006496223,1024,4.66887502742,2048,6.3023084444,4096,-1.77191368702,32,-0.306610079783,64,-1.07538986018,128,-5.82873221396,256,-6.86997352635,512,-2.01337487851,1024,-1.75778024322,2048,-6.09245678276,4096,10.8143459734,32,-3.81209418044,64,-7.24029210473,128,2.91145979098,256,3.59724675963,512,1.39914489569,1024,5.24326163476,2048,-6.73486649276,4096,-9.70963157521,32,3.24836327868,64,2.71228679178,128,2.93919077128,256,6.39152548425,512,-1.75655945461,1024,2.62603706063,2048,-2.17343060136,4096,-3.95235410748,32,3.3143634825,64,-1.00197745219,128,1.56597428627,256,4.51569000439,512,-0.829508383537,1024,-0.247467928589,2048,7.6077371844,4096,-3.50683875179,32,6.90241953835,64,0.874072360418,128,-2.92308620807,256,-6.4488586854,512,-1.90010616369,1024,-6.16897154366,2048,-5.32182870563,4096,-0.68647486429,32,6.97438594743,64,7.14652990669,128,10.4396549785,256,16.5033186093,512,5.72723187708,1024,2.44030715107,2048,5.11801267546,4096,4.76269390175,32,-7.26690871992,64,-1.17207087131,128,3.04857958329,256,2.77207232319,512,-2.89893690851,1024,-1.12226122306,2048,1.90388458936,4096,7.04972962535,32,-3.90148789975,64,-1.37464145306,128,-0.0876318368951,256,0.013302737898,512,-2.6641471513,1024,2.2368055068,2048,1.23984658482,4096,3.18828862054,32,-3.85213721226,64,0.613225011081,128,0.394014717795,256,-0.70372897634,512,0.180413064936,1024,1.50729452826,2048,0.650927962037,4096,6.32741301331,32,-3.82872678595,64,-3.1894877316,128,-6.12209907395,256,1.37618651296,512,-2.46989189905,1024,1.34211707545,2048,0.331307962381,4096,0.864065671735],"p":[93.86,220.67,140.27,221.5,186.68,227.12,233.09,287.7,279.5,339.89,325.91,334.67,372.33,311.94,418.74,334.34,93.86,318.89,140.27,296.33,186.68,206.6,233.09,266.23,279.5,219.09,325.91,189.78,372.33,246.78,418.74,300.12,93.86,351.64,140.27,349.62,186.68,356.13,233.09,358.78,279.5,292.93,325.91,307.17,372.33,283.84,418.74,311.94,93.86,253.76,140.27,275.89,186.68,268.97,233.09,243.44,279.5,222.2,325.91,234.22,372.33,261.56,418.74,315.57,93.86,285.31,140.27,311.38,186.68,286.23,233.09,350.18,279.5,353.12,325.91,253.09,372.33,282.98,418.74,281.25,93.86,351.09,140.27,275.68,186.68,304.26,233.09,279.13,279.5,173.13,325.91,225.04,372.33,295.96,418.74,220.92,93.86,253.36,140.27,182.9,186.68,175.23,233.09,254.48,279.5,269.77,325.91,245.96,372.33,249.89,418.74,292.76,93.86,253.78,140.27,297.15,186.68,292.74,233.09,313.86,279.5,303,325.91,292.13,372.33,302.67,418.74,338.04,93.86,285.53,140.27,311.84,186.68,296.2,233.09,246.76,279.5,205.42,325.91,305.39,372.33,305.47,418.74,243.56,93.86,351.84,140.27,350.45,186.68,351.08,233.09,307.34,279.5,316.63,325.91,356.95,372.33,239.37,418.74,245.47,93.86,351.49,140.27,369.85,186.68,294.75,233.09,292.01,279.5,278.77,325.91,267.57,372.33,327.73,418.74,284.16,93.86,351.56,140.27,312.8,186.68,333.49,233.09,340.4,279.5,346.56,325.91,335.74,372.33,389.51,418.74,315.34,93.86,253.38,140.27,165.49,186.68,210.37,233.09,257.23,279.5,339.43,325.91,326.24,372.33,324.97,418.74,335.5,93.86,284.87,140.27,312.05,186.68,264.46,233.09,241.03,279.5,195.36,325.91,192.4,372.33,147.33,418.74,233.15,93.86,318.81,140.27,313,186.68,291.14,233.09,319.03,279.5,262.78,325.91,314.49,372.33,254.03,418.74,278.25,93.86,219.79,140.27,220.88,186.68,256.54,233.09,199.35,279.5,204.76,325.91,285.7,372.33,288.55,418.74,329.27,93.86,318.51,140.27,312.56,186.68,255.71,233.09,287.23,279.5,265.16,325.91,280.38,372.33,237.56,418.74,291.07,93.86,252.28,140.27,201.33,186.68,257.25,233.09,330.1,279.5,362.82,325.91,331.85,372.33,251.87,418.74,282.99,93.86,285.41,140.27,293.32,186.68,227.01,233.09,266.09,279.5,226.69,325.91,222.29,372.33,292.06,418.74,254.99,93.86,318.21,140.27,257.93,186.68,279.82,233.09,297.62,279.5,267.95,325.91,139.93,372.33,226.18,418.74,328.83,93.86,220.74,140.27,296.69,186.68,299.89,233.09,349,279.5,345.18,325.91,237.27,372.33,280.33,418.74,312.83,93.86,285.29,140.27,256.61,186.68,327.19,233.09,343.5,279.5,260.33,325.91,240,372.33,224.83,418.74,299.83,93.86,286.22,140.27,293.36,186.68,337.52,233.09,347.2,279.5,302.08,325.91,299.7,372.33,339.97,418.74,182.91,93.86,318.79,140.27,350.64,186.68,256.33,233.09,249.96,279.5,270.38,325.91,234.66,372.33,345.94,418.74,373.58,93.86,253.2,140.27,258.18,186.68,256.07,233.09,224,279.5,299.69,325.91,258.98,372.33,303.56,418.74,320.09,93.86,252.58,140.27,292.68,186.68,268.83,233.09,241.42,279.5,291.08,325.91,285.67,372.33,212.7,418.74,315.95,93.86,219.25,140.27,275.25,186.68,310.53,233.09,343.28,279.5,301.03,325.91,340.68,372.33,332.81,418.74,289.75,93.86,218.58,140.27,216.98,186.68,186.39,233.09,130.06,279.5,230.17,325.91,260.7,372.33,235.83,418.74,239.13,93.86,350.88,140.27,294.26,186.68,255.05,233.09,257.62,279.5,310.3,325.91,293.8,372.33,265.69,418.74,217.88,93.86,319.62,140.27,296.14,186.68,284.19,233.09,283.25,279.5,308.12,325.91,262.59,372.33,271.86,418.74,253.75,93.86,319.16,140.27,277.68,186.68,279.71,233.09,289.91,279.5,281.7,325.91,269.37,372.33,277.33,418.74,224.59,93.86,318.94,140.27,313,186.68,340.25,233.09,270.59,279.5,306.32,325.91,270.91,372.33,280.3,418.74,275.35],"r":3.07},{"k":"segments","c":"#8c8c84"},{"k":"segments","c":"#8c8c84"},{"k":"fill","c":"#5b6b7c"},{"k":"annotation","c":"#5c5c57"},{"k":"annotation","c":"#5b6b7c"}],"lg":[]} 32 64 128 256 512 1,024 2,048 4,096 True distinct IDs (each inserted twice) −15% −6.5% 6.5% 0 15% Relative error of 32 seeded runs (%) ±1.04/√m = 6.5% 256 registers: 78% of estimates within ±6.5% {"v":1,"box":[79.2431,633.3921,433.355,955.3555],"x":{"s":"log","lim":[25.7232317038,5095.47173191],"inv":false,"g":1,"t":"True distinct IDs (each inserted twice)","tk":[[32,"32"],[64,"64"],[128,"128"],[256,"256"],[512,"512"],[1024,"1,024"],[2048,"2,048"],[4096,"4,096"]],"b":10},"y":{"s":"linear","lim":[-17.3284845397,17.3284845397],"inv":false,"g":1,"tk":[[-15,"−15%"],[0,"0"],[15,"15%"]]},"ti":"4,096 registers: 91% of estimates within\n±1.6%","a":[{"k":"scatter","c":"#1d5fa6","s":"xy","d":[32,0.392210320842,64,-0.798344243261,128,0.790219228356,256,-0.0576279188209,512,-0.264561463607,1024,-0.949568980658,2048,-0.179003636184,4096,-0.454290265055,32,0.392208499114,64,0.788973643162,128,1.59685384812,256,0.770062905108,512,0.398684378234,1024,0.837172211756,2048,0.00162467467071,4096,-0.68830330918,32,0.392012793811,64,0.788587658337,128,0.788268695194,256,0.342801097553,512,-0.308030798828,1024,-2.28872135907,2048,-0.440720236853,4096,1.0326616052,32,0.391835826907,64,-0.798590730295,128,0.790784781675,256,0.343970029922,512,1.47359108703,1024,0.215817956371,2048,0.784660294312,4096,-1.0090979754,32,0.391864974355,64,-2.38481554458,128,-0.0168197165914,256,-0.492321013428,512,-0.0825424275008,1024,-0.599027140305,2048,-0.163612409729,4096,0.00138522411739,32,0.39182333515,64,0.788390404576,128,0.784269236626,256,0.349548833191,512,2.59290263566,1024,0.990336546102,2048,0.63566982071,4096,0.644107537079,32,0.391966990553,64,0.788352632667,128,0.787282440353,256,-0.484945598626,512,-0.723690645829,1024,-1.43219283216,2048,-0.880494364062,4096,0.0955779943585,32,0.391668229415,64,-0.798736080838,128,0.787211095007,256,-1.32200200048,512,-0.318689006277,1024,-2.05168403551,2048,-1.41048740056,4096,-0.0313636633339,32,0.39175254858,64,-0.798473839689,128,-0.018291555555,256,0.762786064484,512,0.397238280626,1024,-0.357803931623,2048,-0.797559123237,4096,-0.545577895732,32,0.392201212201,64,0.788917115808,128,0.787135552986,256,2.0109075167,512,1.24110190437,1024,0.502394457808,2048,-0.43976401181,4096,-1.52268903751,32,0.392019039714,64,0.790386060679,128,0.793473082938,256,-1.3021592635,512,0.401723505302,1024,0.215064858392,2048,0.414822984976,4096,0.383356456199,32,0.392643633851,64,0.790178307305,128,0.79074910651,256,-0.483075234042,512,-0.954409294257,1024,-0.0482580880456,2048,-0.400932345133,4096,-0.795834960354,32,0.391794187727,64,0.788025277311,128,1.59319532254,256,0.34893309589,512,-0.503555984624,1024,0.121439641378,2048,-0.152716098892,4096,-0.293676161424,32,0.392025285616,64,0.789431241642,128,-0.822285281699,256,-0.484867859962,512,1.26340445684,1024,-0.084150178079,2048,0.452788016424,4096,1.0573313333,32,0.391851441609,64,0.787557330719,128,0.786195483973,256,0.752513124835,512,0.814717771114,1024,-1.89187319898,2048,-0.29365059046,4096,0.999588937304,32,0.39210179799,64,-2.38588731914,128,-2.43412921247,256,-0.0669534329579,512,0.187173654358,1024,0.174432535615,2048,-1.67475983159,4096,-0.520057642659,32,0.392002383976,64,-0.798465708159,128,-0.0163364937894,256,0.338965859487,512,0.568910321433,1024,-0.274103893471,2048,-0.252198705582,4096,-0.985624304118,32,0.391810322905,64,0.788590806009,128,-0.824207428188,256,-1.73328824421,512,-0.279896309758,1024,-1.24803961346,2048,-0.46356998376,4096,-0.415555931844,32,0.392080457792,64,-0.797841609203,128,-0.824053009023,256,-1.31744377089,512,1.94217943443,1024,1.11625617713,2048,-0.810592750757,4096,1.04863653077,32,0.391519369999,64,0.787190111101,128,0.785805192615,256,0.754199098013,512,-1.41594091285,1024,-1.05632949841,2048,0.31876984667,4096,1.66158054339,32,0.391746302711,64,0.788562476962,128,-0.0179678682759,256,-0.0645025593442,512,0.372447674456,1024,-0.434864342455,2048,1.03468292043,4096,-0.608036475992,32,0.392000302009,64,0.788688383959,128,0.788859932748,256,0.346134290655,512,-0.710589050904,1024,-0.947327405711,2048,-1.6664331056,4096,-0.626901163149,32,0.392366729491,64,-2.38450453855,128,-1.62524206816,256,-0.482935605974,512,-0.939486965749,1024,1.14429488226,2048,-0.976874942837,4096,-0.723115216925,32,0.391948252868,64,0.788589756785,128,-0.0186121432824,256,-0.48941639035,512,0.130088050219,1024,0.588079919814,2048,-0.0317262024741,4096,-0.371695601724,32,0.392202253188,64,0.789353597813,128,0.786762041323,256,1.17046002044,512,0.802876725941,1024,-0.00113086916131,2048,0.745942668431,4096,0.986951695126,32,0.391969072518,64,0.788524704925,128,-0.822610385706,256,0.346461901929,512,-0.061864830123,1024,0.492980834888,2048,0.529762518222,4096,1.17860732898,32,0.392014875779,64,0.78897587278,128,-0.0172936421103,256,-0.0613397644727,512,0.620480050342,1024,-0.853518474632,2048,-3.08928905013,4096,-0.70284732071,32,0.392687355732,64,-0.796666574225,128,-0.0118303195557,256,1.19278857016,512,0.85598635235,1024,1.91670793722,2048,1.29763907196,4096,1.35935934298,32,0.392073170898,64,0.789359893254,128,0.790262247959,256,0.766404164742,512,0.177172121297,1024,0.562535397102,2048,-0.512234034335,4096,-1.66677424175,32,0.392166859624,64,0.79058122372,128,0.791638369993,256,-0.0553313470657,512,-0.274070281172,1024,0.39175145407,2048,0.321733982477,4096,-0.62139164682,32,0.39231363898,64,-2.38470728321,128,-1.62878041636,256,-0.481920861284,512,-0.522300899176,1024,1.21739169068,2048,-1.70045413793,4096,-1.36040571138,32,-2.75722604566,64,-0.798994254878,128,-2.43803432255,256,-1.31972293832,512,0.361547764034,1024,-0.573219880673,2048,-1.2237313909,4096,0.609620179051],"p":[93.86,790.73,140.27,801.79,186.68,787.03,233.09,794.91,279.5,796.83,325.91,803.2,372.33,796.04,418.74,798.59,93.86,790.73,140.27,787.04,186.68,779.54,233.09,787.22,279.5,790.67,325.91,786.6,372.33,794.36,418.74,800.77,93.86,790.73,140.27,787.05,186.68,787.05,233.09,791.19,279.5,797.24,325.91,815.64,372.33,798.47,418.74,784.78,93.86,790.73,140.27,801.79,186.68,787.03,233.09,791.18,279.5,780.68,325.91,792.37,372.33,787.08,418.74,803.75,93.86,790.73,140.27,816.53,186.68,794.53,233.09,798.95,279.5,795.14,325.91,799.94,372.33,795.89,418.74,794.36,93.86,790.73,140.27,787.05,186.68,787.09,233.09,791.13,279.5,770.29,325.91,785.17,372.33,788.47,418.74,788.39,93.86,790.73,140.27,787.05,186.68,787.06,233.09,798.88,279.5,801.1,325.91,807.68,372.33,802.55,418.74,793.49,93.86,790.74,140.27,801.79,186.68,787.06,233.09,806.66,279.5,797.33,325.91,813.43,372.33,807.48,418.74,794.67,93.86,790.73,140.27,801.79,186.68,794.54,233.09,787.29,279.5,790.68,325.91,797.7,372.33,801.78,418.74,799.44,93.86,790.73,140.27,787.04,186.68,787.06,233.09,775.69,279.5,782.84,325.91,789.71,372.33,798.46,418.74,808.52,93.86,790.73,140.27,787.03,186.68,787,233.09,806.47,279.5,790.64,325.91,792.38,372.33,790.52,418.74,790.81,93.86,790.73,140.27,787.03,186.68,787.03,233.09,798.86,279.5,803.24,325.91,794.82,372.33,798.1,418.74,801.77,93.86,790.73,140.27,787.05,186.68,779.57,233.09,791.13,279.5,799.05,325.91,793.25,372.33,795.79,418.74,797.1,93.86,790.73,140.27,787.04,186.68,802.01,233.09,798.88,279.5,782.64,325.91,795.16,372.33,790.17,418.74,784.55,93.86,790.73,140.27,787.06,186.68,787.07,233.09,787.38,279.5,786.81,325.91,811.95,372.33,797.1,418.74,785.09,93.86,790.73,140.27,816.54,186.68,816.99,233.09,795,279.5,792.63,325.91,792.75,372.33,809.93,418.74,799.21,93.86,790.73,140.27,801.79,186.68,794.53,233.09,791.22,279.5,789.09,325.91,796.92,372.33,796.72,418.74,803.53,93.86,790.73,140.27,787.05,186.68,802.03,233.09,810.48,279.5,796.97,325.91,805.97,372.33,798.68,418.74,798.23,93.86,790.73,140.27,801.79,186.68,802.03,233.09,806.61,279.5,776.33,325.91,784,372.33,801.9,418.74,784.63,93.86,790.74,140.27,787.06,186.68,787.07,233.09,787.37,279.5,807.53,325.91,804.19,372.33,791.41,418.74,778.94,93.86,790.73,140.27,787.05,186.68,794.54,233.09,794.97,279.5,790.91,325.91,798.41,372.33,784.76,418.74,800.02,93.86,790.73,140.27,787.05,186.68,787.05,233.09,791.16,279.5,800.98,325.91,803.17,372.33,809.85,418.74,800.2,93.86,790.73,140.27,816.53,186.68,809.47,233.09,798.86,279.5,803.1,325.91,783.74,372.33,803.45,418.74,801.09,93.86,790.73,140.27,787.05,186.68,794.55,233.09,798.92,279.5,793.17,325.91,788.91,372.33,794.67,418.74,797.83,93.86,790.73,140.27,787.04,186.68,787.06,233.09,783.5,279.5,786.92,325.91,794.38,372.33,787.44,418.74,785.21,93.86,790.73,140.27,787.05,186.68,802.02,233.09,791.16,279.5,794.95,325.91,789.79,372.33,789.45,418.74,783.42,93.86,790.73,140.27,787.04,186.68,794.53,233.09,794.94,279.5,788.61,325.91,802.3,372.33,823.07,418.74,800.9,93.86,790.73,140.27,801.77,186.68,794.48,233.09,783.29,279.5,786.42,325.91,776.57,372.33,782.32,418.74,781.75,93.86,790.73,140.27,787.04,186.68,787.03,233.09,787.25,279.5,792.73,325.91,789.15,372.33,799.13,418.74,809.86,93.86,790.73,140.27,787.03,186.68,787.02,233.09,794.89,279.5,796.92,325.91,790.73,372.33,791.38,418.74,800.15,93.86,790.73,140.27,816.53,186.68,809.51,233.09,798.85,279.5,799.23,325.91,783.06,372.33,810.17,418.74,807.01,93.86,819.99,140.27,801.8,186.68,817.02,233.09,806.63,279.5,791.02,325.91,799.7,372.33,805.74,418.74,788.71],"r":3.07},{"k":"segments","c":"#8c8c84"},{"k":"segments","c":"#8c8c84"},{"k":"fill","c":"#5b6b7c"},{"k":"annotation","c":"#5c5c57"},{"k":"annotation","c":"#5b6b7c"}],"lg":[]} 32 64 128 256 512 1,024 2,048 4,096 True distinct IDs (each inserted twice) −15% 0 15% Relative error of 32 seeded runs (%) ±1.04/√m = 1.6% 4,096 registers: 91% of estimates within ±1.6%
{"v":1,"box":[70.1337,94.1597,825.5333,417.3575],"x":{"s":"log","lim":[273.790408218,11968.2790253],"inv":false,"g":0,"t":"Counter state (bytes) and the epsilon that sizes it","tk":[[320,"320\n0.2"],[640,"640\n0.1"],[1280,"1,280\n0.05"],[2560,"2,560\n0.025"],[5120,"5,120\n0.0125"],[10240,"10,240\n0.00625"]],"b":10},"y":{"s":"log","lim":[0.4,2500],"inv":false,"g":0,"tk":[[1,"1"],[10,"10"],[100,"100"],[1000,"1,000"]],"b":10},"ti":"The worst overcount stays 2.3–3.6× under the epsilon × N guarantee","a":[{"k":"line","c":"#fffff8","s":"x","d":[320,1657.2,640,828.6,1280,414.3,2560,207.15,5120,103.575,10240,51.7875],"p":[101.32,109.36,239.93,134.99,378.53,160.63,517.14,186.26,655.74,211.89,794.35,237.52]},{"k":"line","c":"#5b6b7c","s":"x","d":[320,1657.2,640,828.6,1280,414.3,2560,207.15,5120,103.575,10240,51.7875],"p":[101.32,109.36,239.93,134.99,378.53,160.63,517.14,186.26,655.74,211.89,794.35,237.52]},{"k":"line","c":"#fffff8","s":"x","d":[320,644,640,367,1280,151,2560,68,5120,29,10240,19],"p":[101.32,144.31,239.93,165.11,378.53,197.95,517.14,227.45,655.74,258.96,794.35,274.6]},{"k":"line","c":"#1d5fa6","s":"x","d":[320,644,640,367,1280,151,2560,68,5120,29,10240,19],"p":[101.32,144.31,239.93,165.11,378.53,197.95,517.14,227.45,655.74,258.96,794.35,274.6]},{"k":"line","c":"#fffff8","s":"x","d":[320,280.140625,640,116.154296875,1280,47.51171875,2560,17.478515625,5120,5.8173828125,10240,1.5185546875],"p":[101.32,175.09,239.93,207.65,378.53,240.71,517.14,277.68,655.74,318.36,794.35,368.03]},{"k":"line","c":"#c4501b","s":"x","d":[320,280.140625,640,116.154296875,1280,47.51171875,2560,17.478515625,5120,5.8173828125,10240,1.5185546875],"p":[101.32,175.09,239.93,207.65,378.53,240.71,517.14,277.68,655.74,318.36,794.35,368.03]},{"k":"segments","c":"#8c8c84"},{"k":"segments","c":"#8c8c84"},{"k":"annotation","c":"#5c5c57"},{"k":"annotation","c":"#5b6b7c"},{"k":"annotation","c":"#1d5fa6"},{"k":"annotation","c":"#c4501b"}],"lg":[]} 320 0.2 640 0.1 1,280 0.05 2,560 0.025 5,120 0.0125 10,240 0.00625 Counter state (bytes) and the epsilon that sizes it 1 10 100 1,000 Overcount on a skewed stream of N = 8,286 events epsilon × N guarantee Worst ID Mean across IDs The worst overcount stays 2.3–3.6× under the epsilon × N guarantee
{"v":1,"box":[70.1337,122.3921,364.4613,417.3575],"x":{"s":"log","lim":[273.790408218,11968.2790253],"inv":false,"g":0,"t":"Counter state (bytes) and the epsilon that sizes it","tk":[[320,"320\n0.2"],[640,"640\n0.1"],[1280,"1,280\n0.05"],[2560,"2,560\n0.025"],[5120,"5,120\n0.0125"],[10240,"10,240\n0.00625"]],"b":10},"y":{"s":"log","lim":[0.4,2500],"inv":false,"g":0,"tk":[[1,"1"],[10,"10"],[100,"100"],[1000,"1,000"]],"b":10},"ti":"The worst overcount stays 2.3–3.6× under\nthe epsilon × N guarantee","a":[{"k":"line","c":"#fffff8","s":"x","d":[320,1657.2,640,828.6,1280,414.3,2560,207.15,5120,103.575,10240,51.7875],"p":[82.28,136.27,136.29,159.66,190.29,183.05,244.3,206.44,298.31,229.84,352.31,253.23]},{"k":"line","c":"#5b6b7c","s":"x","d":[320,1657.2,640,828.6,1280,414.3,2560,207.15,5120,103.575,10240,51.7875],"p":[82.28,136.27,136.29,159.66,190.29,183.05,244.3,206.44,298.31,229.84,352.31,253.23]},{"k":"line","c":"#fffff8","s":"x","d":[320,644,640,367,1280,151,2560,68,5120,29,10240,19],"p":[82.28,168.17,136.29,187.14,190.29,217.11,244.3,244.04,298.31,272.8,352.31,287.07]},{"k":"line","c":"#1d5fa6","s":"x","d":[320,644,640,367,1280,151,2560,68,5120,29,10240,19],"p":[82.28,168.17,136.29,187.14,190.29,217.11,244.3,244.04,298.31,272.8,352.31,287.07]},{"k":"line","c":"#fffff8","s":"x","d":[320,280.140625,640,116.154296875,1280,47.51171875,2560,17.478515625,5120,5.8173828125,10240,1.5185546875],"p":[82.28,196.26,136.29,225.97,190.29,256.14,244.3,289.88,298.31,327.01,352.31,372.34]},{"k":"line","c":"#c4501b","s":"x","d":[320,280.140625,640,116.154296875,1280,47.51171875,2560,17.478515625,5120,5.8173828125,10240,1.5185546875],"p":[82.28,196.26,136.29,225.97,190.29,256.14,244.3,289.88,298.31,327.01,352.31,372.34]},{"k":"segments","c":"#8c8c84"},{"k":"segments","c":"#8c8c84"},{"k":"annotation","c":"#5c5c57"},{"k":"annotation","c":"#5b6b7c"},{"k":"annotation","c":"#1d5fa6"},{"k":"annotation","c":"#c4501b"}],"lg":[]} 320 0.2 640 0.1 1,280 0.05 2,560 0.025 5,120 0.0125 10,240 0.00625 Counter state (bytes) and the epsilon that sizes it 1 10 100 1,000 Overcount on a skewed stream of N = 8,286 events epsilon × N guarantee Worst ID Mean across IDs The worst overcount stays 2.3–3.6× under the epsilon × N guarantee
{"v":1,"box":[58.8056,94.1597,854.9333,444.3555],"x":{"s":"linear","lim":[0.0346666666667,0.809777777778],"inv":false,"g":0,"t":"Exact Jaccard similarity of two 128-ID sets","tk":[[0.0666666666667,"0.07"],[0.142857142857,"0.14"],[0.230769230769,"0.23"],[0.333333333333,"0.33"],[0.454545454545,"0.45"],[0.6,"0.60"],[0.777777777778,"0.78"]]},"y":{"s":"linear","lim":[-0.184846932433,0.184846932433],"inv":false,"g":0,"tk":[[-0.1,"−0.1"],[0,"0"],[0.1,"0.1"]]},"ti":"32 coordinates: 54 of 56 within ±2 SE, worst miss 0.14","a":[{"k":"scatter","c":"#1d5fa6","s":"xy","d":[0.0666666666667,0.0583333333333,0.142857142857,0.0446428571429,0.230769230769,0.0192307692308,0.333333333333,-0.0208333333333,0.454545454545,0.0142045454545,0.6,-0.06875,0.777777777778,0.00347222222222,0.0666666666667,-0.0354166666667,0.142857142857,-0.0178571428571,0.230769230769,-0.0120192307692,0.333333333333,0.0416666666667,0.454545454545,0.0142045454545,0.6,0.025,0.777777777778,0.0659722222222,0.0666666666667,0.0270833333333,0.142857142857,0.0758928571429,0.230769230769,0.0504807692308,0.333333333333,0.135416666667,0.454545454545,0.139204545455,0.6,0.025,0.777777777778,-0.0277777777778,0.0666666666667,-0.0666666666667,0.142857142857,-0.0491071428571,0.230769230769,-0.0432692307692,0.333333333333,0.0416666666667,0.454545454545,0.0142045454545,0.6,0.0875,0.777777777778,0.0347222222222,0.0666666666667,0.0583333333333,0.142857142857,0.0446428571429,0.230769230769,0.0504807692308,0.333333333333,0.0729166666667,0.454545454545,0.139204545455,0.6,0.11875,0.777777777778,0.0972222222222,0.0666666666667,0.0895833333333,0.142857142857,0.0446428571429,0.230769230769,0.0504807692308,0.333333333333,0.0104166666667,0.454545454545,0.0454545454545,0.6,0.05625,0.777777777778,-0.0277777777778,0.0666666666667,0.0583333333333,0.142857142857,0.138392857143,0.230769230769,0.0817307692308,0.333333333333,0.0104166666667,0.454545454545,-0.0795454545455,0.6,-0.00625,0.777777777778,0.0347222222222,0.0666666666667,-0.0354166666667,0.142857142857,0.0133928571429,0.230769230769,-0.0120192307692,0.333333333333,-0.0833333333333,0.454545454545,-0.0795454545455,0.6,0.025,0.777777777778,0.0347222222222],"p":[91.67,214,169.93,226.97,260.23,251.04,365.57,288.99,490.07,255.8,639.47,334.38,822.07,265.97,91.67,302.81,169.93,286.17,260.23,280.64,365.57,229.79,490.07,255.8,639.47,245.58,822.07,206.76,91.67,243.6,169.93,197.37,260.23,221.44,365.57,140.98,490.07,137.39,639.47,245.58,822.07,295.57,91.67,332.41,169.93,315.77,260.23,310.24,365.57,229.79,490.07,255.8,639.47,186.37,822.07,236.37,91.67,214,169.93,226.97,260.23,221.44,365.57,200.19,490.07,137.39,639.47,156.77,822.07,177.16,91.67,184.4,169.93,226.97,260.23,221.44,365.57,259.39,490.07,226.2,639.47,215.97,822.07,295.57,91.67,214,169.93,138.16,260.23,191.84,365.57,259.39,490.07,344.61,639.47,275.18,822.07,236.37,91.67,302.81,169.93,256.57,260.23,280.64,365.57,348.2,490.07,344.61,639.47,245.58,822.07,236.37],"r":3.07},{"k":"segments","c":"#8c8c84"},{"k":"segments","c":"#8c8c84"},{"k":"fill","c":"#5b6b7c"},{"k":"annotation","c":"#5c5c57"},{"k":"annotation","c":"#5b6b7c"}],"lg":[]} 0.07 0.14 0.23 0.33 0.45 0.60 0.78 Exact Jaccard similarity of two 128-ID sets −0.1 0 0.1 Estimate − exact, 8 seeded runs ±2 standard errors 32 coordinates: 54 of 56 within ±2 SE, worst miss 0.14 {"v":1,"box":[58.8056,605.1597,854.9333,955.3555],"x":{"s":"linear","lim":[0.0346666666667,0.809777777778],"inv":false,"g":1,"t":"Exact Jaccard similarity of two 128-ID sets","tk":[[0.0666666666667,"0.07"],[0.142857142857,"0.14"],[0.230769230769,"0.23"],[0.333333333333,"0.33"],[0.454545454545,"0.45"],[0.6,"0.60"],[0.777777777778,"0.78"]]},"y":{"s":"linear","lim":[-0.184846932433,0.184846932433],"inv":false,"g":1,"tk":[[-0.1,"−0.1"],[0,"0"],[0.1,"0.1"]]},"ti":"256 coordinates: 53 of 56 within ±2 SE, worst miss 0.08","a":[{"k":"scatter","c":"#1d5fa6","s":"xy","d":[0.0666666666667,0.0231770833333,0.142857142857,0.0485491071429,0.230769230769,0.0387620192308,0.333333333333,0.0182291666667,0.454545454545,0.0376420454545,0.6,0.02109375,0.777777777778,0.0151909722222,0.0666666666667,-0.0197916666667,0.142857142857,-0.0295758928571,0.230769230769,-0.0159254807692,0.333333333333,-0.00911458333333,0.454545454545,-0.0287642045455,0.6,-0.03359375,0.777777777778,-0.00434027777778,0.0666666666667,-0.00416666666667,0.142857142857,-0.00223214285714,0.230769230769,-0.0159254807692,0.333333333333,-0.0169270833333,0.454545454545,0.00639204545455,0.6,-0.01015625,0.777777777778,-0.0121527777778,0.0666666666667,-0.0197916666667,0.142857142857,0.0133928571429,0.230769230769,0.0270432692308,0.333333333333,0.0299479166667,0.454545454545,-0.00142045454545,0.6,0.02109375,0.777777777778,-0.0199652777778,0.0666666666667,-0.00807291666667,0.142857142857,0.00948660714286,0.230769230769,0.0348557692308,0.333333333333,0.0416666666667,0.454545454545,0.0571732954545,0.6,0.00546875,0.777777777778,0.0425347222222,0.0666666666667,0.0388020833333,0.142857142857,0.0290178571429,0.230769230769,0.00360576923077,0.333333333333,0.0260416666667,0.454545454545,0.0220170454545,0.6,0.00546875,0.777777777778,-0.0355902777778,0.0666666666667,-0.0119791666667,0.142857142857,0.00558035714286,0.230769230769,0.00751201923077,0.333333333333,-0.00130208333333,0.454545454545,-0.0443892045455,0.6,-0.0375,0.777777777778,-0.00824652777778,0.0666666666667,0.0231770833333,0.142857142857,0.00948660714286,0.230769230769,0.0231370192308,0.333333333333,0.0182291666667,0.454545454545,0.0259232954545,0.6,0.07578125,0.777777777778,0.0347222222222],"p":[91.67,758.3,169.93,734.27,260.23,743.54,365.57,762.99,490.07,744.6,639.47,760.28,822.07,765.87,91.67,799.01,169.93,808.27,260.23,795.34,365.57,788.89,490.07,807.5,639.47,812.08,822.07,784.37,91.67,784.2,169.93,782.37,260.23,795.34,365.57,796.29,490.07,774.2,639.47,789.88,822.07,791.77,91.67,799.01,169.93,767.57,260.23,754.64,365.57,751.89,490.07,781.6,639.47,760.28,822.07,799.17,91.67,787.9,169.93,771.27,260.23,747.24,365.57,740.79,490.07,726.1,639.47,775.08,822.07,739.97,91.67,743.5,169.93,752.77,260.23,776.84,365.57,755.59,490.07,759.4,639.47,775.08,822.07,813.97,91.67,791.6,169.93,774.97,260.23,773.14,365.57,781.49,490.07,822.31,639.47,815.78,822.07,788.07,91.67,758.3,169.93,771.27,260.23,758.34,365.57,762.99,490.07,755.7,639.47,708.47,822.07,747.37],"r":3.07},{"k":"segments","c":"#8c8c84"},{"k":"segments","c":"#8c8c84"},{"k":"fill","c":"#5b6b7c"},{"k":"annotation","c":"#5c5c57"},{"k":"annotation","c":"#5b6b7c"}],"lg":[]} 0.07 0.14 0.23 0.33 0.45 0.60 0.78 Exact Jaccard similarity of two 128-ID sets −0.1 0 0.1 Estimate − exact, 8 seeded runs ±2 standard errors 256 coordinates: 53 of 56 within ±2 SE, worst miss 0.08
{"v":1,"box":[58.8056,122.3921,406.9333,444.3555],"x":{"s":"linear","lim":[0.0346666666667,0.809777777778],"inv":false,"g":0,"t":"Exact Jaccard similarity of two 128-ID sets","tk":[[0.0666666666667,"0.07"],[0.142857142857,"0.14"],[0.230769230769,"0.23"],[0.333333333333,"0.33"],[0.454545454545,"0.45"],[0.6,"0.60"],[0.777777777778,"0.78"]]},"y":{"s":"linear","lim":[-0.184846932433,0.184846932433],"inv":false,"g":0,"tk":[[-0.1,"−0.1"],[0,"0"],[0.1,"0.1"]]},"ti":"32 coordinates: 54 of 56 within ±2 SE,\nworst miss 0.14","a":[{"k":"scatter","c":"#1d5fa6","s":"xy","d":[0.0666666666667,0.0583333333333,0.142857142857,0.0446428571429,0.230769230769,0.0192307692308,0.333333333333,-0.0208333333333,0.454545454545,0.0142045454545,0.6,-0.06875,0.777777777778,0.00347222222222,0.0666666666667,-0.0354166666667,0.142857142857,-0.0178571428571,0.230769230769,-0.0120192307692,0.333333333333,0.0416666666667,0.454545454545,0.0142045454545,0.6,0.025,0.777777777778,0.0659722222222,0.0666666666667,0.0270833333333,0.142857142857,0.0758928571429,0.230769230769,0.0504807692308,0.333333333333,0.135416666667,0.454545454545,0.139204545455,0.6,0.025,0.777777777778,-0.0277777777778,0.0666666666667,-0.0666666666667,0.142857142857,-0.0491071428571,0.230769230769,-0.0432692307692,0.333333333333,0.0416666666667,0.454545454545,0.0142045454545,0.6,0.0875,0.777777777778,0.0347222222222,0.0666666666667,0.0583333333333,0.142857142857,0.0446428571429,0.230769230769,0.0504807692308,0.333333333333,0.0729166666667,0.454545454545,0.139204545455,0.6,0.11875,0.777777777778,0.0972222222222,0.0666666666667,0.0895833333333,0.142857142857,0.0446428571429,0.230769230769,0.0504807692308,0.333333333333,0.0104166666667,0.454545454545,0.0454545454545,0.6,0.05625,0.777777777778,-0.0277777777778,0.0666666666667,0.0583333333333,0.142857142857,0.138392857143,0.230769230769,0.0817307692308,0.333333333333,0.0104166666667,0.454545454545,-0.0795454545455,0.6,-0.00625,0.777777777778,0.0347222222222,0.0666666666667,-0.0354166666667,0.142857142857,0.0133928571429,0.230769230769,-0.0120192307692,0.333333333333,-0.0833333333333,0.454545454545,-0.0795454545455,0.6,0.025,0.777777777778,0.0347222222222],"p":[73.18,232.57,107.4,244.49,146.88,266.63,192.95,301.52,247.39,271,312.72,343.25,392.56,280.35,73.18,314.22,107.4,298.93,146.88,293.84,192.95,247.09,247.39,271,312.72,261.6,392.56,225.92,73.18,259.79,107.4,217.28,146.88,239.41,192.95,165.44,247.39,162.14,312.72,261.6,392.56,307.57,73.18,341.43,107.4,326.14,146.88,321.06,192.95,247.09,247.39,271,312.72,207.17,392.56,253.13,73.18,232.57,107.4,244.49,146.88,239.41,192.95,219.87,247.39,162.14,312.72,179.96,392.56,198.7,73.18,205.36,107.4,244.49,146.88,239.41,192.95,274.3,247.39,243.79,312.72,234.39,392.56,307.57,73.18,232.57,107.4,162.85,146.88,212.2,192.95,274.3,247.39,352.65,312.72,288.82,392.56,253.13,73.18,314.22,107.4,271.71,146.88,293.84,192.95,355.95,247.39,352.65,312.72,261.6,392.56,253.13],"r":3.07},{"k":"segments","c":"#8c8c84"},{"k":"segments","c":"#8c8c84"},{"k":"fill","c":"#5b6b7c"},{"k":"annotation","c":"#5c5c57"},{"k":"annotation","c":"#5b6b7c"}],"lg":[]} 0.07 0.14 0.23 0.33 0.45 0.60 0.78 Exact Jaccard similarity of two 128-ID sets −0.1 0 0.1 Estimate − exact, 8 seeded runs ±2 standard errors 32 coordinates: 54 of 56 within ±2 SE, worst miss 0.14 {"v":1,"box":[58.8056,633.3921,406.9333,955.3555],"x":{"s":"linear","lim":[0.0346666666667,0.809777777778],"inv":false,"g":1,"t":"Exact Jaccard similarity of two 128-ID sets","tk":[[0.0666666666667,"0.07"],[0.142857142857,"0.14"],[0.230769230769,"0.23"],[0.333333333333,"0.33"],[0.454545454545,"0.45"],[0.6,"0.60"],[0.777777777778,"0.78"]]},"y":{"s":"linear","lim":[-0.184846932433,0.184846932433],"inv":false,"g":1,"tk":[[-0.1,"−0.1"],[0,"0"],[0.1,"0.1"]]},"ti":"256 coordinates: 53 of 56 within ±2 SE,\nworst miss 0.08","a":[{"k":"scatter","c":"#1d5fa6","s":"xy","d":[0.0666666666667,0.0231770833333,0.142857142857,0.0485491071429,0.230769230769,0.0387620192308,0.333333333333,0.0182291666667,0.454545454545,0.0376420454545,0.6,0.02109375,0.777777777778,0.0151909722222,0.0666666666667,-0.0197916666667,0.142857142857,-0.0295758928571,0.230769230769,-0.0159254807692,0.333333333333,-0.00911458333333,0.454545454545,-0.0287642045455,0.6,-0.03359375,0.777777777778,-0.00434027777778,0.0666666666667,-0.00416666666667,0.142857142857,-0.00223214285714,0.230769230769,-0.0159254807692,0.333333333333,-0.0169270833333,0.454545454545,0.00639204545455,0.6,-0.01015625,0.777777777778,-0.0121527777778,0.0666666666667,-0.0197916666667,0.142857142857,0.0133928571429,0.230769230769,0.0270432692308,0.333333333333,0.0299479166667,0.454545454545,-0.00142045454545,0.6,0.02109375,0.777777777778,-0.0199652777778,0.0666666666667,-0.00807291666667,0.142857142857,0.00948660714286,0.230769230769,0.0348557692308,0.333333333333,0.0416666666667,0.454545454545,0.0571732954545,0.6,0.00546875,0.777777777778,0.0425347222222,0.0666666666667,0.0388020833333,0.142857142857,0.0290178571429,0.230769230769,0.00360576923077,0.333333333333,0.0260416666667,0.454545454545,0.0220170454545,0.6,0.00546875,0.777777777778,-0.0355902777778,0.0666666666667,-0.0119791666667,0.142857142857,0.00558035714286,0.230769230769,0.00751201923077,0.333333333333,-0.00130208333333,0.454545454545,-0.0443892045455,0.6,-0.0375,0.777777777778,-0.00824652777778,0.0666666666667,0.0231770833333,0.142857142857,0.00948660714286,0.230769230769,0.0231370192308,0.333333333333,0.0182291666667,0.454545454545,0.0259232954545,0.6,0.07578125,0.777777777778,0.0347222222222],"p":[73.18,774.19,107.4,752.09,146.88,760.62,192.95,778.5,247.39,761.59,312.72,776,392.56,781.14,73.18,811.61,107.4,820.13,146.88,808.24,192.95,802.31,247.39,819.42,312.72,823.63,392.56,798.15,73.18,798,107.4,796.32,146.88,808.24,192.95,809.12,247.39,788.81,312.72,803.22,392.56,804.96,73.18,811.61,107.4,782.71,146.88,770.82,192.95,768.29,247.39,795.61,312.72,776,392.56,811.76,73.18,801.4,107.4,786.11,146.88,764.02,192.95,758.09,247.39,744.58,312.72,789.61,392.56,757.33,73.18,760.58,107.4,769.1,146.88,791.23,192.95,771.69,247.39,775.2,312.72,789.61,392.56,825.37,73.18,804.81,107.4,789.51,146.88,787.83,192.95,795.51,247.39,833.03,312.72,827.03,392.56,801.56,73.18,774.19,107.4,786.11,146.88,774.22,192.95,778.5,247.39,771.8,312.72,728.38,392.56,764.13],"r":3.07},{"k":"segments","c":"#8c8c84"},{"k":"segments","c":"#8c8c84"},{"k":"fill","c":"#5b6b7c"},{"k":"annotation","c":"#5c5c57"},{"k":"annotation","c":"#5b6b7c"}],"lg":[]} 0.07 0.14 0.23 0.33 0.45 0.60 0.78 Exact Jaccard similarity of two 128-ID sets −0.1 0 0.1 Estimate − exact, 8 seeded runs ±2 standard errors 256 coordinates: 53 of 56 within ±2 SE, worst miss 0.08
  • Membership can return a false positive. The rate rises when a filter fills past its design load.
  • Choose the sketch by the question: membership, distinct count, frequency, or similarity.

Hover or focus a chart for exact values. Each change reruns demo.ts against knotkit/scalar-sketch in your browser; the defaults reproduce the README figure.

ExportReturnsDoes
stringSplitBlockBloomFilterStringSplitBlockBloomFilterString membership with no false negatives. `expectedEntries` is required; the block count rounds up to a power of two.
bytesSplitBlockBloomFilterBytesSplitBlockBloomFilterMembership over `Uint8Array` values, hashing the raw bytes.
uint32SplitBlockBloomFilterUint32SplitBlockBloomFilterMembership over integers in `0..2^32 - 1`, hashed without an encoding step.
uint64SplitBlockBloomFilterUint64SplitBlockBloomFilterMembership over `bigint` values in `0n..2^64 - 1n`.
stringHyperLogLogStringHyperLogLogDistinct-count estimate over strings, by Ertl's improved raw estimator over one-byte registers.
bytesHyperLogLogBytesHyperLogLogDistinct-count estimate over `Uint8Array` values; `precision` defaults to 14 and may be reduced exactly.
uint32HyperLogLogUint32HyperLogLogDistinct-count estimate over integers in `0..2^32 - 1`.
uint64HyperLogLogUint64HyperLogLogDistinct-count estimate over `bigint` values in `0n..2^64 - 1n`.
stringCountMinSketchStringCountMinSketchPer-value frequency over strings; the minimum counter across rows never underestimates an accepted stream.
bytesCountMinSketchBytesCountMinSketchPer-value frequency over `Uint8Array` values; weights are unsigned 32-bit integers and zero is a no-op.
uint32CountMinSketchUint32CountMinSketchPer-value frequency over integers in `0..2^32 - 1`.
uint64CountMinSketchUint64CountMinSketchPer-value frequency over `bigint` values in `0n..2^64 - 1n`.
stringMinHashStringMinHashJaccard-estimate signature over strings: `signatureSize` ordered coordinate minima, prefix-stable under `reduce`.
bytesMinHashBytesMinHashJaccard-estimate signature over `Uint8Array` values; `signatureSize` defaults to 128.
uint32MinHashUint32MinHashJaccard-estimate signature over integers in `0..2^32 - 1`.
uint64MinHashUint64MinHashJaccard-estimate signature over `bigint` values in `0n..2^64 - 1n`.

Cost per member. Open a row for every operation.

stringSplitBlockBloomFilter 4 members
MemberCost
updateO(length)
mightContainO(length)
mergeO(blockCount)
reduceO(blockCount)
bytesSplitBlockBloomFilter 4 members
MemberCost
updateO(length)
mightContainO(length)
mergeO(blockCount)
reduceO(blockCount)
uint32SplitBlockBloomFilter 4 members
MemberCost
updateO(1)
mightContainO(1)
mergeO(blockCount)
reduceO(blockCount)
uint64SplitBlockBloomFilter 4 members
MemberCost
updateO(1)
mightContainO(1)
mergeO(blockCount)
reduceO(blockCount)
stringHyperLogLog 4 members
MemberCost
updateO(length)
estimateO(registerCount) after a write, O(1) for repeated reads
mergeO(registerCount)
reduceO(registerCount)
bytesHyperLogLog 4 members
MemberCost
updateO(length)
estimateO(registerCount) after a write, O(1) for repeated reads
mergeO(registerCount)
reduceO(registerCount)
uint32HyperLogLog 4 members
MemberCost
updateO(1)
estimateO(registerCount) after a write, O(1) for repeated reads
mergeO(registerCount)
reduceO(registerCount)
uint64HyperLogLog 4 members
MemberCost
updateO(1)
estimateO(registerCount) after a write, O(1) for repeated reads
mergeO(registerCount)
reduceO(registerCount)
stringCountMinSketch 4 members
MemberCost
updateO(depth * length)
estimateO(depth * length)
mergeO(width * depth)
reduceO(width * depth)
bytesCountMinSketch 4 members
MemberCost
updateO(depth * length)
estimateO(depth * length)
mergeO(width * depth)
reduceO(width * depth)
uint32CountMinSketch 4 members
MemberCost
updateO(depth)
estimateO(depth)
mergeO(width * depth)
reduceO(width * depth)
uint64CountMinSketch 4 members
MemberCost
updateO(depth)
estimateO(depth)
mergeO(width * depth)
reduceO(width * depth)
stringMinHash 5 members
MemberCost
updateO(signatureSize * length)
snapshotO(signatureSize)
similarityO(signatureSize)
mergeO(signatureSize)
reduceO(signatureSize)
bytesMinHash 5 members
MemberCost
updateO(signatureSize * length)
snapshotO(signatureSize)
similarityO(signatureSize)
mergeO(signatureSize)
reduceO(signatureSize)
uint32MinHash 5 members
MemberCost
updateO(signatureSize)
snapshotO(signatureSize)
similarityO(signatureSize)
mergeO(signatureSize)
reduceO(signatureSize)
uint64MinHash 5 members
MemberCost
updateO(signatureSize)
snapshotO(signatureSize)
similarityO(signatureSize)
mergeO(signatureSize)
reduceO(signatureSize)
InputTypeGet one from
hash identity, the seeded XXH64 instance that produces every digest and decides whether two sketches may mergebigint seed selecting an XXH64 identityknotkit/hash
seed, defaulting to `0n` and folded into merge compatibility; an invalid seed surfaces `HashInvalidInputError` from `knotkit/hash`bigintknotkit/hash

Every error this module throws is ScalarSketchInvalidInputError or ScalarSketchParseError, with a code from a closed, exported list. Branch on the code; the message is for people.

ScalarSketchInvalidInputError
INVALID_PROBABILITY INVALID_DIMENSION INVALID_PRECISION INVALID_SIGNATURE_SIZE STATE_TOO_LARGE
ScalarSketchParseError
FOREIGN_STRUCTURE WRONG_FAMILY INCOMPATIBLE_SKETCH INVALID_REDUCTION INVALID_WEIGHT CAPACITY_EXCEEDED COUNTER_OVERFLOW INVALID_SHAPE INVALID_ENVELOPE INVALID_MAGIC UNSUPPORTED_ENVELOPE_VERSION UNSUPPORTED_PAYLOAD_VERSION INVALID_SECTION_GEOMETRY NONZERO_PADDING MISALIGNED_SECTION TRUNCATED_PAYLOAD INVALID_CODEC_RESULT DECODE_BUDGET_EXCEEDED UNSTABLE_BUFFER WRONG_FORMAT INTEGRITY_MISMATCH INVALID_PACKAGE_HEADER UNKNOWN_KIND UNKNOWN_SCALAR_KIND UNSUPPORTED_WIRE_VERSION UNSUPPORTED_PRODUCER_VERSION UNSUPPORTED_SCHEDULE INVALID_STATE

Serialization lives in a separate entrypoint, knotkit/scalar-sketch/wire, so code that never saves a structure never loads a parser.

Functions
serializeScalarSketch, deserializeScalarSketch, serializeScalarSketchJson, deserializeScalarSketchJson
Formats
binary, json
Compatibility
schema-versioned, envelope v1
If you need to…Use instead
an exact set, where a false positive is unacceptableSet, Map
the exact count of a value, or a count that never exaggeratesMap<K, number>
read back the values that were observedknotkit/snapshot-set
keep a bounded random sample of the stream instead of a summary of itknotkit/sampling
test membership in a key set that is complete before the first query and never changes, in fewer bytesknotkit/static-filter

Measured by the suite in packages/scalar-sketch/__tests__/bench. The numbers come from one machine, so run the suite on yours before deciding on speed alone.

Prompt · knotkit/scalar-sketch
Use knotkit/scalar-sketch for this task. If Knotkit is missing, follow https://knotkit.jkomyno.dev/getting-started.md#install-from-source. Import from 'knotkit/scalar-sketch'.

Exports:
- `stringSplitBlockBloomFilter` → `StringSplitBlockBloomFilter`: String membership with no false negatives. `expectedEntries` is required; the block count rounds up to a power of two.
- `bytesSplitBlockBloomFilter` → `BytesSplitBlockBloomFilter`: Membership over `Uint8Array` values, hashing the raw bytes.
- `uint32SplitBlockBloomFilter` → `Uint32SplitBlockBloomFilter`: Membership over integers in `0..2^32 - 1`, hashed without an encoding step.
- `uint64SplitBlockBloomFilter` → `Uint64SplitBlockBloomFilter`: Membership over `bigint` values in `0n..2^64 - 1n`.
- `stringHyperLogLog` → `StringHyperLogLog`: Distinct-count estimate over strings, by Ertl's improved raw estimator over one-byte registers.
- `bytesHyperLogLog` → `BytesHyperLogLog`: Distinct-count estimate over `Uint8Array` values; `precision` defaults to 14 and may be reduced exactly.
- `uint32HyperLogLog` → `Uint32HyperLogLog`: Distinct-count estimate over integers in `0..2^32 - 1`.
- `uint64HyperLogLog` → `Uint64HyperLogLog`: Distinct-count estimate over `bigint` values in `0n..2^64 - 1n`.
- `stringCountMinSketch` → `StringCountMinSketch`: Per-value frequency over strings; the minimum counter across rows never underestimates an accepted stream.
- `bytesCountMinSketch` → `BytesCountMinSketch`: Per-value frequency over `Uint8Array` values; weights are unsigned 32-bit integers and zero is a no-op.
- `uint32CountMinSketch` → `Uint32CountMinSketch`: Per-value frequency over integers in `0..2^32 - 1`.
- `uint64CountMinSketch` → `Uint64CountMinSketch`: Per-value frequency over `bigint` values in `0n..2^64 - 1n`.
- `stringMinHash` → `StringMinHash`: Jaccard-estimate signature over strings: `signatureSize` ordered coordinate minima, prefix-stable under `reduce`.
- `bytesMinHash` → `BytesMinHash`: Jaccard-estimate signature over `Uint8Array` values; `signatureSize` defaults to 128.
- `uint32MinHash` → `Uint32MinHash`: Jaccard-estimate signature over integers in `0..2^32 - 1`.
- `uint64MinHash` → `Uint64MinHash`: Jaccard-estimate signature over `bigint` values in `0n..2^64 - 1n`.

Pick the layout by these rules:
- `stringSplitBlockBloomFilter` (kind 'split-block-bloom-filter') when the question is membership, a rare false positive is acceptable, and `expectedEntries` is known before the first update; the `string`, `bytes`, `uint32`, and `uint64` factories are this one layout over four value domains
- `stringHyperLogLog` (kind 'hyperloglog') when the question is how many distinct values there are, the reported `relativeStandardError` of `1.04 / sqrt(registerCount)` is acceptable, and the values themselves need not be retained; the four domain factories differ only in how a value is hashed
- `stringCountMinSketch` (kind 'count-min-sketch') when the question is how often each value occurred, an overestimate is acceptable, and the reported `epsilon` and `confidence` bounds fit the caller's tolerance; the four domain factories differ only in how a value is hashed
- `stringMinHash` (kind 'minhash') when the question is how much two sets overlap, as an estimated Jaccard index, one signature per set fits where the sets do not, and `maximumStandardError` of `1 / (2 * sqrt(signatureSize))` is acceptable
- `string*` (kind 'string') when values are JavaScript strings and the caller accepts O(length) hashing per operation, which every string-domain sketch pays on `update` and on the query that takes a value
- `bytes*` (kind 'bytes') when values are `Uint8Array` byte sequences, such as digests or serialized records, and hashing those exact bytes is what the caller wants
- `uint32*` (kind 'uint32') when values are integers in `0..2^32 - 1`, so every operation hashes in O(1) with no encoding step
- `uint64*` (kind 'uint64') when values are `bigint`s in `0n..2^64 - 1n`, so every operation hashes in O(1) and the full 64-bit domain survives

Inputs and their sources:
- hash identity, the seeded XXH64 instance that produces every digest and decides whether two sketches may merge: `bigint seed selecting an XXH64 identity` from `knotkit/hash`
- seed, defaulting to `0n` and folded into merge compatibility; an invalid seed surfaces `HashInvalidInputError` from `knotkit/hash`: `bigint` from `knotkit/hash`

Use something else when:
- an exact set, where a false positive is unacceptable → Set, Map
- the exact count of a value, or a count that never exaggerates → Map<K, number>
- read back the values that were observed → knotkit/snapshot-set
- keep a bounded random sample of the stream instead of a summary of it → knotkit/sampling
- test membership in a key set that is complete before the first query and never changes, in fewer bytes → knotkit/static-filter

Errors are ScalarSketchInvalidInputError or ScalarSketchParseError with a `code` property. Branch on `error.code`, never on the message. Save and load through `knotkit/scalar-sketch/wire` (serializeScalarSketch, deserializeScalarSketch, serializeScalarSketchJson, deserializeScalarSketchJson).

Full page: https://knotkit.jkomyno.dev/modules/scalar-sketch.md
Types: node_modules/knotkit/scalar-sketch/ and https://knotkit.jkomyno.dev/reference/knotkit/scalar-sketch/