code wiki / _hdl_build / nx_search_latency_bench.nx
nx_search_latency_bench.nx
buildroot/runtime/_hdl_build/nx_search_latency_bench.nx
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
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
structs
| none |
consts
| 11 | const K_MAGIC_200000: i64 = 200000 |
functions
| 13 | func 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 |
| 14 | func lb_len(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } return n } called by 1: main |
| 15 | func lb_num(v: i64) -> i64 called by 1: main |
| 25 | func main() -> i64 |