benchmark
In-Language Micro-Benchmarking
Functions
| Function | Description |
|---|---|
bench_now_ns | Get current timestamp in nanoseconds. |
bench_start | Start a benchmark timer. |
bench_stop | Stop timer, return elapsed nanoseconds. |
bench_ms | Stop timer, return elapsed milliseconds. |
bench_us | Stop timer, return elapsed microseconds. |
bench_print_int | Internal: print integer. |
bench_report | Print benchmark result: “name: 12345ns (12.345ms)” |
bench_iter | Run fn_ptr() n times. Returns total nanoseconds. |
bench_iter_report | Run fn_ptr() n times and print results. |
Details
bench_now_ns
fn bench_now_ns() -> i64Get current timestamp in nanoseconds.
bench_start
fn bench_start() -> i64Start a benchmark timer.
bench_stop
fn bench_stop(start: i64) -> i64Stop timer, return elapsed nanoseconds.
bench_ms
fn bench_ms(start: i64) -> i64Stop timer, return elapsed milliseconds.
bench_us
fn bench_us(start: i64) -> i64Stop timer, return elapsed microseconds.
bench_print_int
fn bench_print_int(val: i64)Internal: print integer.
bench_report
fn bench_report(name: &i8, nlen: i64, start: i64)Print benchmark result: “name: 12345ns (12.345ms)”
bench_iter
fn bench_iter(fn_ptr: i64, n: i64) -> i64Run fn_ptr() n times. Returns total nanoseconds.
bench_iter_report
fn bench_iter_report(name: &i8, nlen: i64, fn_ptr: i64, n: i64)Run fn_ptr() n times and print results.