Expand description
§subms-stats
Latency-distribution statistics for measurement-heavy workloads.
Pure functions on &[u64] sample arrays + an ergonomic
SubMsSamples facade.
This is the statistics primitive the subms perf harness uses
internally, published as its own crate so you can use it without
pulling in the bench machinery. Bring your own Vec<u64> of
nanosecond readings (from any source) and compose the analyses you
need.
§Feature flags
The crate ships a tiny core that’s always on (percentile,
mean, stddev) plus optional features that you opt into via Cargo:
histogram(default) - log2-spaced CDF bucketsjitter(default) - per-window variance scoretail(default) - CTE, Hill estimator, fatness ratiorobust(default) - IQR, MAD, CoV, skewness, kurtosiscompare(default) - KS statistic, Cohen’s dbootstrap(default) - bootstrap CIs for percentiles
Everything is on by default. For a minimal build:
[dependencies]
subms-stats = { version = "0.5", default-features = false }Then pick only the features you need:
subms-stats = { version = "0.5", default-features = false, features = ["histogram", "tail"] }§Quickstart
use subms_stats::SubMsSamples;
let raw = vec![100u64, 200, 150, 300, 250, 175, 125, 400];
let s = SubMsSamples::new(&raw);
let p99 = s.p99();
let _ = p99;Re-exports§
pub use percentiles::mean;pub use percentiles::percentile;pub use percentiles::percentile_sweep;pub use percentiles::stddev;pub use samples::SubMsSamples;pub use bootstrap::bootstrap_percentile_ci;pub use compare::cohens_d;pub use compare::ks_statistic;pub use histogram::cdf_buckets;pub use jitter::jitter_score;pub use robust::coefficient_of_variation;pub use robust::iqr;pub use robust::kurtosis;pub use robust::median_absolute_deviation;pub use robust::skewness;pub use tail::conditional_tail_expectation;pub use tail::hill_tail_index;pub use tail::tail_fatness_ratio;
Modules§
- bootstrap
- Bootstrap confidence intervals. Behind the
bootstrapCargo feature (on by default). - compare
- Distribution comparison: “is candidate slower than baseline?”
Behind the
compareCargo feature (on by default). - histogram
- Log2-spaced CDF buckets. Behind the
histogramCargo feature (on by default). - jitter
- Jitter score: was the measurement environment stable across the
run? Behind the
jitterCargo feature (on by default). - percentiles
- Core percentiles + first-moment statistics. Always available; no Cargo feature gate.
- robust
- Robust statistics: low sensitivity to outliers, useful when the
raw distribution has a heavy tail (which latency typically does).
Behind the
robustCargo feature (on by default). - samples
- Ergonomic wrapper around a borrowed
&[u64]slice of nanosecond latency samples. Method-chained API for the common statistics. - tail
- Tail analysis: the bit institutional users actually care about.
Behind the
tailCargo feature (on by default).