code wiki / (root) / nx_bench_hll_vs_datasketches.nx

nx_bench_hll_vs_datasketches.nx

buildroot/runtime/nx_bench_hll_vs_datasketches.nx

7645 B190 linesdepth 6pulls 14 transitivereach 0 importersview sourcekind benchtopic bench
docsdependenciesstructsconstsfunctions

about

nx_bench_hll_vs_datasketches.nx -- honest head-to-head. Drives nx_sketch_hll over 100k xorshift64 keys, then emits per-axis verdicts via nx_perf_verdict against Apache DataSketches' published HLL_4 baseline from specs/nx_perf_baselines.txt. Per the honest-perf-verdict cardinal: every LOSE row names a specific fix. Per the stop-and-build-upward cardinal: when the fix lives in nxc2 (no native target), the verdict stays UNMEASURABLE rather than projecting native equivalents. Baselines hardcoded for now (this is the FIRST head-to-head; future drivers should read specs/nx_perf_baselines.txt). genealogy_id: substrate_perf_bench_2026_05_14 lineage_id: honest_hard_feedback

dependencies 6 imports · 0 importers

nx_syscalls.nx nx_runtime.nx nx_tier.nx nx_clock.nx nx_sketch_hll.nx nx_perf_verdict.nx nx_bench_hll_vs_datasketches.n

imports: nx_syscalls.nxnx_runtime.nxnx_tier.nxnx_clock.nxnx_sketch_hll.nxnx_perf_verdict.nx

imported by: nobody (leaf or entry point)

call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown

main nx_hll_alloc sys_mmap sys_mmap ↻ nx_clock_monotonic_ns sys_mmap ↻ sys_clock_gettime_mono nx_hll_vd_xorshift64 nx_hll_vd_i64_to_bytes nx_hll_add murmur3_32 mm_load_u32_le mm_rotl32 nx_clz32 nx_bits_clz32 nx_hll_estimate nx_hll_pow2_neg_q32 nx_hll_alpha_m_sq_q64 nx_hll_bias_table_n nx_hll_bias_table_get nx_hll_bias_lgk4 nx_hll_bias_lgk5 nx_hll_bias_lgk6 nx_hll_bias_lgk7 nx_hll_bias_lgk8 nx_hll_bias_lgk9 nx_hll_bias_lgk10 nx_hll_log2_ppm nx_hll_bias_correct nx_hll_bias_table_n ↻ nx_hll_bias_table_get ↻ nx_mulshl_div_i64 nx_i128_alloc nx_i128_mul_i64 nx_i128_mul_u64 nx_i128_neg nx_i128_shl nx_i128_div_i64 nx_i128_is_neg nx_i128_neg ↻

structs

none

consts

30const NX_MAGIC_1000000000: i64 = 1000000000
31const NX_MAGIC_1000000: i64 = 1000000
33const NX_HLL_VD_N: nx_int = 100000
39const NX_HLL_VD_LGK: nx_int = 10
40const NX_HLL_VD_SEED: nx_int = 1442695040888963407
46const NX_HLL_DS_THROUGHPUT_IPS: nx_int = 75000000 // ~50-100M typical
47const NX_HLL_DS_MEMORY_BYTES_K10: nx_int = 1024 // 4 bits * 2^10 = 4096 bits = 512 B regs + ~512 B header
48const NX_HLL_DS_RSD_PCT_Q4_K10: nx_int = 325 // 1.04/sqrt(2^10)*100*100 = 3.25% in pct_q4
49const NX_HLL_DS_MAX_LGK: nx_int = 21
50const NX_HLL_VD_MAX_LGK: nx_int = 10 // ours

functions

53func nx_hll_vd_xorshift64(state_p: *nx_int) -> nx_int
called by 1: main
62func nx_hll_vd_i64_to_bytes(v: nx_int, out: *u8)
called by 1: main
73func main() -> nx_exit