code wiki / (root) / sketch_comparator.nx

sketch_comparator.nx

buildroot/runtime/sketch_comparator.nx

7908 B211 linesdepth 4pulls 4 transitivereach 31 importersview sourcekind sketch/demotopic sketch
docsdependenciesstructsconstsfunctions

about

sketch_comparator.nx -- sealed-verdict comparator for head-to-head stomp claims. THE VALIDATION PRIMITIVE. Every claim of the form "our primitive beats incumbent X on axis Y" must pass through this. Sealed verdicts: NX_CMP_VERDICT_BEATS our primitive measurably better NX_CMP_VERDICT_EQUIVALENT within tolerance band; can't distinguish NX_CMP_VERDICT_LOSES incumbent measurably better NX_CMP_VERDICT_INCONCLUSIVE missing data or degenerate inputs THREE INDEPENDENT AXES: ACCURACY -- whoever's closer to ground truth wins MEMORY -- smaller bytes wins TIME -- faster wall-time wins COMPOSITE verdict aggregates 3 axis verdicts via majority vote with inconclusive-axis discounting. A 2/3 majority with one INCONCLUSIVE is enough to call. A 1/1/1 tie returns EQUIVALENT. All inputs are i64; caller supplies measurements from external runs. This primitive does NOT itself run benchmarks -- it normalizes the VERDICT against typed tolerance, so claims become falsifiable. LOSSLESS-LANGUAGE DISCIPLINE: result struct carries verdict + signed delta in PPM (positive = our wins) + ppb confidence.

dependencies 2 imports · 31 importers

syscalls.nx sketch_types.nx sketch_comparator.nx bench_hll_vs_cpc.nx bench_hll_vs_cpcd.nx sketch_ams_vs_naive_bench.nx sketch_cb_vs_cuckoo_delete_bench.n sketch_comparator_test.nx sketch_count_sketch_negative_bench sketch_count_sketch_vs_cms_bias_be sketch_cuckoo_delete_vs_bloom_benc sketch_cusum_vs_threshold_bench.nx sketch_ddsketch_vs_tdigest_tail_be

diagram shows first 10 each side; +0 more imports, +21 more importers in the complete lists below.

imports: syscalls.nxsketch_types.nx

imported by: bench_hll_vs_cpc.nxbench_hll_vs_cpcd.nxsketch_ams_vs_naive_bench.nxsketch_cb_vs_cuckoo_delete_bench.nxsketch_comparator_test.nxsketch_count_sketch_negative_bench.nxsketch_count_sketch_vs_cms_bias_bench.nxsketch_cuckoo_delete_vs_bloom_bench.nxsketch_cusum_vs_threshold_bench.nxsketch_ddsketch_vs_tdigest_tail_bench.nxsketch_freq_directions_vs_topnorm_bench.nxsketch_hll4_vs_hll8_bench.nxsketch_hll_lgk12_vs_lgk8_bench.nxsketch_hll_packed_vs_hll8_bench.nxsketch_hll_vs_materialized_set_bench.nxsketch_hllmap_merge_capability_bench.nxsketch_holt_vs_ewma_trended_bench.nxsketch_kll_vs_reservoir_bench.nxsketch_kmv_jaccard_vs_naive_bench.nxsketch_lc_vs_hll_small_n_bench.nxsketch_mann_kendall_vs_endpoint_bench.nxsketch_markov_vs_uniform_bench.nxsketch_mg_ss_bracket_bench.nxsketch_naive_bayes_vs_majority_bench.nxsketch_reqsketch_vs_kll_bench.nxsketch_robust_hll_vs_hll_adv_bench.nxsketch_tdigest_v2_vs_v1_bench.nxsketch_tdigest_vs_materialized_quantile_bench.nxsketch_theta_intersect_vs_hll_bench.nxsketch_thompson_vs_ucb1_bench.nxsketch_varopt_vs_reservoir_biased_bench.nx

structs

39struct ComparisonResult {

consts

30const NX_CMP_VERDICT_BEATS: i64 = 0
31const NX_CMP_VERDICT_EQUIVALENT: i64 = 1
32const NX_CMP_VERDICT_LOSES: i64 = 2
33const NX_CMP_VERDICT_INCONCLUSIVE: i64 = 3
35const NX_CMP_AXIS_ACCURACY: i64 = 0
36const NX_CMP_AXIS_MEMORY: i64 = 1
37const NX_CMP_AXIS_TIME: i64 = 2

functions

48func nx_cmp_iabs(x: i64) -> i64 {
called by 1: nx_cmp_accuracy
62func nx_cmp_accuracy(our: i64, theirs: i64, truth: i64, tolerance_ppm: i64) -> *ComparisonResult {
called by 18: mainmainmainmainmainmain+12 calls 1: nx_cmp_iabs
99func nx_cmp_memory(our_bytes: i64, their_bytes: i64, tolerance_ppm: i64) -> *ComparisonResult {
called by 18: mainmainmainmainmainmain+12
131func nx_cmp_time(our_us: i64, their_us: i64, tolerance_ppm: i64) -> *ComparisonResult {
called by 3: mainmainmain
172func nx_cmp_composite(acc: *ComparisonResult, mem: *ComparisonResult,
202func nx_cmp_query(r: *ComparisonResult) -> *ApproxI64 {
called by 1: main calls 1: nx_approx_new
209func nx_cmp_memory_bytes(r: *ComparisonResult) -> i64 {