subms 0.2.1

Zero-dependency perf-test harness for Rust: timed stages, percentiles, and a stable JSON shape consumed by the submillisecond.com cookbook. Includes a `Recipe` trait for cookbook benchmarks.
Documentation
//! A trivial example: implement a no-op recipe and emit its harness JSON.
//! Intended as a copy-paste template for new cookbook recipes.

use std::io;

use subms::{benchmark, BenchParams, PerfHarness, Recipe};

struct NoopRecipe;

impl Recipe for NoopRecipe {
    fn name(&self) -> &str {
        "noop"
    }

    fn run(&self, h: &mut PerfHarness, params: &BenchParams) {
        let stage = h.stage("tick", params.entries);
        for _ in 0..params.entries {
            stage.time(|| {});
        }
    }
}

fn main() {
    let params = BenchParams {
        entries: 1_000,
        warmup: 0,
        seed: 0,
    };
    let h = benchmark(&NoopRecipe, &params);
    let mut out = io::stdout().lock();
    h.write_json(&mut out).expect("write json");
}