code wiki / _hdl_build / nx_search_bench.nx

nx_search_bench.nx

buildroot/runtime/_hdl_build/nx_search_bench.nx

6493 B141 linesdepth 3pulls 3 transitivereach 0 importersview sourcekind benchtopic search
docsdependenciesstructsconstsfunctions

about

nx_search_bench.nx -- REAL head-to-head onsite-search benchmark (operator: benchmark vs a real incumbent, get baseline from Google Scholar). BASELINE = Google Scholar's actual ranked results for "web development" (fetched live via the browse tool) with real citation counts as the authority signal. METRIC = citation-graded nDCG@10 (standard IR), discount table as DATA. Compares Scholar's relevance ranking vs OUR BM25 ranker over the SAME 10 results. HONEST SCOPE: 1 query, 10 docs (a real slice, not full BEIR -- W-BENCH-DATA-001); data + metric REAL, nothing fabricated. Hand-written = motivates X-AUT-GATE-001 (team authors benchmarks). license_tier: ORIGINAL

dependencies 2 imports · 0 importers

nx_syscalls.nx nx_itoa_lib.nx nx_search_bench.nx

imports: nx_syscalls.nxnx_itoa_lib.nx

imported by: nobody (leaf or entry point)

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

main sys_mmap sb_score_all sys_mmap ↻ sb_doclen sb_tf sb_tok_end sb_bm25 sb_rank sys_mmap ↻ sb_dcg sb_w sys_write sb_n nxi_out nxi_fd sys_mmap ↻ ccz_cat_num sys_write ↻ sys_munmap sys_exit

structs

none

consts

10const K_MAGIC_22000000: i64 = 22000000
11const K_MAGIC_1269: i64 = 1269
12const K_MAGIC_1717: i64 = 1717

functions

14func sb_w(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 calls 1: sys_write
19func sb_n(v: i64) -> i64 { nxi_out(v); return 0 }
called by 1: main calls 1: nxi_out
21func sb_doclen(s: *u8) -> i64 { var n: i64=0; var t: i64=0; var inw: i64=0; while s[n]!=(0 as u8){ if s[n]==(32 as u8){inw=0} else { if inw==0{t=t+1;inw=1} } n=n+1 } return t }
called by 1: sb_score_all
23func sb_tok_end(s: *u8, start: i64) -> i64 { var e: i64=start; var fe: i64=1; while fe==1 { if s[e]==(0 as u8){fe=0} else { if s[e]==(32 as u8){fe=0} else {e=e+1} } } return e }
called by 1: sb_tf
25func sb_tf(s: *u8, term: *u8) -> i64
called by 1: sb_score_all calls 1: sb_tok_end
44func sb_bm25(tf: i64, doclen: i64, avgdl: i64) -> i64
called by 1: sb_score_all
53func sb_score_all(titles: *i64, n: i64, score: *i64) -> i64
called by 1: main calls 4: sys_mmapsb_doclensb_tfsb_bm25
69func sb_rank(score: *i64, n: i64, ord: *i64) -> i64
called by 1: main calls 1: sys_mmap
84func sb_dcg(gain: *i64, order: *i64, disc: *i64, n: i64) -> i64
called by 1: main
90func main() -> i64