# subms
A tiny, std-only perf-test harness for Rust programs. Records timed samples per stage, computes percentiles, and emits a stable JSON shape suitable for upload to [submillisecond.com](https://submillisecond.com) cookbook samples.
**Zero external dependencies.**
`v0.1.0` — early development. The API is not yet stable.
## Quick start
```rust
use subms::PerfHarness;
let mut h = PerfHarness::new("lsm-tree", "rust");
h.input("entries", &50_000.to_string());
h.input("bloom_mode", "on");
h.meta("sstables", "46");
let put = h.stage("put", 50_000);
for _ in 0..50_000 {
put.time(|| { /* work under test */ });
}
h.write_json(&mut std::io::stdout()).unwrap();
```
## Output shape
Stable JSON, matching the companion Java harness in the submillisecond.com cookbook:
```json
{
"workload": "lsm-tree",
"lang": "rust",
"timestamp": "2026-05-13T20:24:38Z",
"inputs": { "entries": "50000", "bloom_mode": "on" },
"meta": { "sstables": "46" },
"stages": {
"put": {
"count": 50000,
"p50_ns": 1234, "p99_ns": 9876, "p999_ns": 12345, "max_ns": 54321,
"mean_ns": 2222,
"samples_ns": [ ... downsampled to 500 evenly-spaced points ... ]
}
}
}
```
## License
Dual-licensed under either of [MIT](LICENSE-MIT) or [Apache-2.0](LICENSE-APACHE), at your option.