sketch_theta_intersect_vs_hll_bench.nx
buildroot/runtime/sketch_theta_intersect_vs_hll_bench.nx
about
sketch_theta_intersect_vs_hll_bench.nx -- capability bench, Theta vs HLL.
CLAIM TO VALIDATE:
Theta sketch (Beyer-Haas-Reinwald-Sismanis-Gemulla 2007) supports
set INTERSECTION via direct subspace pruning: A∩B is the keys
below min(theta_A, theta_B) that appear in BOTH samples.
HLL has NO direct intersection. The standard workaround is
inclusion-exclusion: |A∩B| = |A| + |B| - |A∪B|. This is
notoriously unstable -- variance grows quadratically with the
underlying cardinalities even when the true |A∩B| is small.
Substrate ships both; this bench DEMONSTRATES Theta's direct
intersection beats HLL's inclusion-exclusion on the small-overlap
regime where HLL's variance explodes.
WORKLOAD:
Two sets at MATCHED memory budgets (k vs lg_k chosen so byte
footprints are within 25%):
Set A: 10000 keys
Set B: 10000 keys (disjoint except for 100 shared)
True |A∩B| = 100 (heavy on |A| + |B|, light on intersection)
MEASUREMENT:
theta_inter = nx_theta_intersect(a, b) -> direct |A∩B| estimate
hll_inter = max(0, |A| + |B| - |A∪B|) via inclusion-exclusion
ACCURACY axis: closer to truth=100 wins.
dependencies 5 imports · 0 importers
imports: syscalls.nxsketch_theta.nxsketch_hll.nxsketch_comparator.nxsketch_types.nx
imported by: nobody (leaf or entry point)
call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown
structs
| none |
consts
| none |
functions
| 35 | func iabs_th(x: i64) -> i64 called by 1: main |
| 40 | func write_bth(buf: *u8, value: i64) -> i64 called by 1: main |
| 51 | func main() -> i64 |