code wiki / _hdl_build / nx_search_latency_bench.nx

nx_search_latency_bench.nx

buildroot/runtime/_hdl_build/nx_search_latency_bench.nx

4005 B81 linesdepth 5pulls 8 transitivereach 0 importersview sourcekind benchtopic search
docsdependenciesstructsconstsfunctions

about

nx_search_latency_bench.nx -- MEASURED LATENCY for nishi search over the real ~700-doc library shard: 40 timed full-pipeline queries (BM25 + consent + phrase machinery engaged), monotonic-clock micros, insertion-sorted -> p50 / p95 / max. These are ADVERSARIAL 3-4-term queries matching hundreds of docs; REAL user queries (1-2 terms) measure 26-116ms LIVE (shown on every SERP, externally verified). Two SOTA optimizations are engaged: two-stage WAND/BlockMax shortlist (cheap postings-only stage-1 caps the expensive doc-walk stage-2) + a per-doc tf-scan cap; together they cut p95 ~2x (280->137ms measured). The residual is query-time tf RECOMPUTATION; the SOTA elimination is precomputed-tf-in-postings = the named perf STORE RUNG (conceded in the census). GREEN floor = a REGRESSION GUARD at the measured p95 + margin, NOT an aspirational target -- raise (tighten) it when the perf rung lands. license_tier: ORIGINAL

dependencies 1 imports · 0 importers

nx_docportal_search_serve.nx nx_search_latency_bench.nx

imports: nx_docportal_search_serve.nx

imported by: nobody (leaf or entry point)

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

main lb_puts dsv_now_us sys_clock_gettime_mono sys_munmap dss_search dss_search_off dss_search_off_div dss_prefix dss_open_maybe_cached dsc_web_prefix_is ss_open ss_open2 dsc_manifest_sig ss_cat sys_fstatat sys_munmap ↻ sys_munmap ↻ ss_close sys_munmap ↻ ss_open2 ↻ ss_tok_table ss_tok_next2 ss_u8cp ss_fold_cp ss_fold_word_cp ss_is_cjk dss_streq dss_stem_expand nx_stem stm_ends stm_measure stm_hasvowel stm_dbl_consonant_end stm_cvc dss_tlen ss_term_count ss_r32 ss_term_at ss_r32 ↻

structs

none

consts

11const K_MAGIC_200000: i64 = 200000

functions

13func lb_puts(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } sys_write(1, s, n); return 0 }
called by 1: main
14func lb_len(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } return n }
called by 1: main
15func lb_num(v: i64) -> i64
called by 1: main
25func main() -> i64