benchmark-simple 0.1.3

A tiny, super simple and portable benchmarking library.
Documentation

benchmark-simple

A tiny benchmarking library for Rust.

  • Trivial to use
  • Works pretty much everywhere, including WebAssembly (WASI, but also in-browser)
use benchmark_simple::*;

fn test_function() {
    // ...
}

let bench = Bench::new();
let res = bench.run(None, || test_function());
println!("result: {}", res);

Throughput computation:

use benchmark_simple::*;

fn test_function(m: &mut [u8]) {
    // ...
}

let mut m = vec![0u8; 1_000_000];
let bench = Bench::new();
let res = bench.run(None, || test_function(&mut m));
let throughput = res.throughput(m.len() as _);
println!("throughput: {}", throughput);