code wiki / (root) / nx_sha256_perf_test.nx

nx_sha256_perf_test.nx

buildroot/runtime/nx_sha256_perf_test.nx

2366 B83 linesdepth 5pulls 5 transitivereach 0 importersview sourcekind gate/prooftopic sha256
docsdependenciesstructsconstsfunctions

about

nx_sha256_perf_test.nx -- bench substrate SHA-256 on a fixed input. Hashes a deterministic 64 KiB buffer N=20 times in a loop, captures in-program wall-clock via sys_clock_gettime_mono (substrate's mono clock). Prints elapsed nanoseconds + N + bytes-per-iteration so a shell wrapper can compute MB/s. Same input + N=20 will run against system sha256sum for honest substrate-vs-incumbent comparison. expect_exit: 0 license_tier: ORIGINAL

dependencies 2 imports · 0 importers

nx_syscalls.nx nx_sha256.nx nx_sha256_perf_test.nx

imports: nx_syscalls.nxnx_sha256.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 sha256_digest sys_mmap ↻ sha256_init sys_mmap ↻ sha256_k sha256_update sha256_compress_ni_blocks blk_set_byte sha256_compress sha256_compress_ni blk_word blk_byte sha256_final blk_set_byte ↻ sha256_compress ↻ _print_i64 sys_write sys_mmap ↻

structs

none

consts

18const BUF_BYTES: i64 = 65536 // 64 KiB
19const N_ITER: i64 = 20 // 1.25 MiB total work

functions

21func _print_i64(label: *u8, label_len: i64, v: i64) -> i64
called by 1: main calls 2: sys_writesys_mmap
47func main() -> i64