code wiki / (root) / nx_perf_bench.nx

nx_perf_bench.nx

buildroot/runtime/nx_perf_bench.nx

6105 B204 linesdepth 3pulls 5 transitivereach 1 importersview sourcekind benchtopic perf
docsdependenciesstructsconstsfunctions

about

nx_perf_bench.nx -- substrate-native performance benchmark primitive. Closes long-pending task #15. Substrate primitive that: 1. Times an operation N times via nx_clock_monotonic_ns 2. Computes min / median / mean / p99 over the runs 3. Compares against a declared baseline (incumbent_label + ns) 4. Returns a sealed verdict: BEATS / TIES / LOSES / NO_BASELINE Used by the TheoremCard's `perf_vs_*_status` fields per S_CLASS_MATH_DOCTRINE axis 3. genealogy_id: knuth_taocp_v1 + benchmarking_discipline lineage_id: performance_measurement + sealed_verdict axioms: NX_AX_ORD_LEAST_UPPER_BOUND (timing values total-ordered)

dependencies 3 imports · 1 importers

syscalls.nx nx_axioms.nx nx_clock.nx nx_perf_bench.nx nx_perf_bench_test.nx

imports: syscalls.nxnx_axioms.nxnx_clock.nx

imported by: nx_perf_bench_test.nx

structs

35struct PerfRun

consts

28const NX_PERF_VERDICT_NO_BASELINE: i64 = 0
29const NX_PERF_VERDICT_WINS: i64 = 1 // ours <= baseline
30const NX_PERF_VERDICT_LOSES: i64 = 2 // ours > baseline by >= 10%
31const NX_PERF_VERDICT_TIES: i64 = 3 // within 10%
49const NX_PERF_RUN_BYTES: i64 = 88

functions

51func nx_perf_run_alloc(label: *u8, n_iter: i64) -> *PerfRun
called by 1: main
69func nx_perf_record_sample(r: *PerfRun, idx: i64, ns: i64) -> i64
called by 1: main
78func nx_perf_sort_samples(r: *PerfRun) -> i64
called by 1: nx_perf_summarize
97func nx_perf_summarize(r: *PerfRun) -> i64
called by 1: main calls 1: nx_perf_sort_samples
118func nx_perf_set_baseline(r: *PerfRun, baseline_label: *u8, baseline_ns: i64) -> i64
called by 1: main
138func pb_putc(fd: i64, c: i64) -> i64
called by 1: pb_i64
145func pb_str(fd: i64, s: *u8, n: i64) -> i64
called by 1: nx_perf_emit_card
150func pb_strz(fd: i64, s: *u8) -> i64
called by 1: nx_perf_emit_card
157func pb_i64(fd: i64, n: i64) -> i64
181func nx_perf_emit_card(fd: i64, r: *PerfRun) -> i64
called by 1: main calls 3: pb_strpb_strzpb_i64