code wiki / (root) / nx_regprof_test.nx

nx_regprof_test.nx

buildroot/runtime/nx_regprof_test.nx

6020 B143 linesdepth 6pulls 8 transitivereach 0 importersview sourcekind gate/proof
docsdependenciesstructsconstsfunctions

about

nx_regprof_test.nx -- DECOMPOSE the reg_put cost. A profiler, not a gate. WHY: debt 1785519597 records "reg_put costs ~678ms per append vs reg_get ~70us". That number is REAL (measured on this host) but it is an AGGREGATE, and an aggregate names no fix. Whoever owns seg_store needs to know WHERE the 678ms goes, and the source offers two very different candidate explanations: (a) THE PLANE LOCK, added 2026-07-31. reg_put now takes <prefix>plock via sts_lock. If another writer family holds it, every put pays contention -- and the fix is scheduling, not storage. (b) THE FULL-INDEX-PER-SEGMENT SHAPE. Per the source: "every reg segment carries the FULL index", so ss_get walks every segment and each put copies the whole index forward. The fix there is the store layout, and it gets worse with every row. Those imply OPPOSITE work. u2605AN AGGREGATE THAT CANNOT DISTINGUISH TWO OPPOSITE FIXES IS NOT YET A MEASUREMENT -- it is a symptom. This probe separates them by timing the phases independently against a FRESH prefix (so segment count starts at zero) and reporting per-op microseconds for each. It also measures GROWTH: the same put timed at row 1 and at row 20. If cost is flat, the lock or a per-commit fsync dominates and (a) is the story. If cost climbs with row count, the full-index copy dominates and (b) is the story. u2605THE SLOPE, NOT THE MAGNITUDE, IS THE DISCRIMINATOR. Reports only. Kills nothing, changes nothing, writes only to its own nonce-scoped prefix. license_tier: ORIGINAL No hw writes (Rule 26). expect_exit: 0

dependencies 3 imports · 0 importers

nx_registry.nx nx_store_seed_lib.nx nx_gate_verdict.nx nx_regprof_test.nx

imports: nx_registry.nxnx_store_seed_lib.nxnx_gate_verdict.nx

imported by: nobody (leaf or entry point)

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

main sys_now_us sys_mmap sys_clock_gettime_mono rp_cat rp_catn gv_ctr sys_mmap ↻ gv_head gv_puts sys_write sts_lock sts_mm sys_mmap ↻ sts_werr sys_write ↻ sys_exit ss_cat sys_openat_append sts_werr ↻ sys_flock sts_unlock sys_flock ↻ sys_close gv_puts ↻ gv_num sys_mmap ↻ sys_write ↻ sys_munmap ss_get sys_mmap ↻ ss_scan sys_mmap ↻ ss_manifest_dyn ss_manifest_file_dyn sys_mmap ↻ ss_cat ↻ ss_readall sys_openat_rd sys_lseek

structs

none

consts

none

functions

30func rp_cat(dst: *u8, off: i64, s: *u8) -> i64 { var i: i64 = 0; while s[i] != (0 as u8) { dst[off+i] = s[i]; i = i + 1 } return off + i }
called by 1: main
31func rp_catn(dst: *u8, off: i64, v: i64) -> i64
called by 1: main
43func main(argc: i64, argv: *i64) -> i64