code wiki / (root) / sketch_mg_ss_bracket_bench.nx

sketch_mg_ss_bracket_bench.nx

buildroot/runtime/sketch_mg_ss_bracket_bench.nx

5700 B166 linesdepth 5pulls 7 transitivereach 0 importersview sourcekind benchtopic sketch
docsdependenciesstructsconstsfunctions

about

sketch_mg_ss_bracket_bench.nx -- bracketing capability paired bench. CLAIM TO VALIDATE: Misra-Gries (1982) UNDERESTIMATES the count: mg_est <= truth. SpaceSaving (Metwally et al. 2005) OVERESTIMATES: ss_est >= truth. Together they BRACKET the true count. Apache DataSketches ships only the SpaceSaving-direction "frequent items" sketch. Substrate ships BOTH; bracket gives callers a guaranteed-correct interval (mg_est, ss_est) within which the true count lies. Capability EXCEED. WORKLOAD: k=10 for both. Heavy items 1..5 with counts 2000/1000/500/200/100. Noise: 500 singletons. Total N=4300. N/(k+1)=391 -- items 1..3 are guaranteed heavy (truth >= 391); items 4 and 5 are borderline. MEASUREMENT: For items 1..3 (guaranteed heavy): - mg_est <= truth (sealed underestimate property) - ss_est >= truth (sealed overestimate property) - bracket_width = ss_est - mg_est > 0 (non-degenerate interval) - truth INSIDE [mg_est, ss_est] Aggregate: signed bias over 3 items mg_signed <= 0 across all items (underestimate is sealed) ss_signed >= 0 across all items (overestimate is sealed)

dependencies 5 imports · 0 importers

syscalls.nx sketch_misra_gries.nx sketch_space_saving.nx sketch_comparator.nx sketch_types.nx sketch_mg_ss_bracket_bench.nx

imports: syscalls.nxsketch_misra_gries.nxsketch_space_saving.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

main nx_mg_alloc nx_ss_alloc nx_mg_add nx_mg_find_key nx_mg_counter_at nx_mg_counter_at ↻ nx_mg_find_empty nx_mg_counter_at ↻ nx_mg_min_count nx_mg_counter_at ↻ if_le nx_ss_add nx_ss_find_key nx_ss_find_min nx_mg_estimate nx_mg_find_key ↻ nx_mg_counter_at ↻ nx_ss_estimate nx_ss_find_key ↻ nx_mg_upper_bound nx_mg_estimate ↻ nx_mg_max_undercount nx_ss_lower_bound nx_ss_find_key ↻

structs

none

consts

none

functions

35func main() -> i64