pub struct Stats {
sorted: Vec<u64>,
taken: Vec<u64>,
mean: u64,
}Expand description
A series of samples and the order statistics read off it.
Holds the samples twice: sorted, because everything below is an order statistic, and in the order the run took them, because that is what the report carries and a baseline is only useful if the samples themselves survive into it — a summary cannot be compared against a later run with anything better than arithmetic on summaries.
The two copies exist for a reason a sorted one alone cannot serve. Issue #205 asks whether a run-to-run disagreement is drift within a suite or between two of them, and a sorted array cannot answer it: whether the slow samples were the first three or the last three is exactly the information sorting throws away. Nothing in this file reads the run order — every statistic below is an order statistic and the bootstrap resamples with replacement — so keeping it costs one vector and buys a question that could not be asked before.
Fields§
§sorted: Vec<u64>§taken: Vec<u64>The same samples, in the order the run took them. Reported; not read.
mean: u64Implementations§
Source§impl Stats
impl Stats
pub fn min(&self) -> u64
pub fn max(&self) -> u64
pub fn median(&self) -> f64
pub fn p25(&self) -> f64
pub fn p75(&self) -> f64
Sourcepub fn iqr(&self) -> f64
pub fn iqr(&self) -> f64
The interquartile range: the width of the middle half of the series.
This is the spread to read. Unlike max - min it does not grow just
because the series got longer and so had more chances to catch one
bad sample.
Sourcepub fn to_json(&self) -> String
pub fn to_json(&self) -> String
The summary, as a JSON object.
min, mean and max are first and keep their names, because ADR
0012 describes this object as {min, mean, max} and a reader written
against that description must keep working.
Sourcepub fn to_json_with_samples(&self) -> String
pub fn to_json_with_samples(&self) -> String
The summary with every sample beside it.
What makes a recorded run a baseline rather than a memory of one: a comparison needs the samples, not a summary of them, because the interval it reports is built by resampling them.
In the order the run took them, which is strictly more than a
sorted array says and costs a reader who wanted the sorted one a
sort. Nothing that compares two runs is affected — every statistic
here is an order statistic and Comparison::of sorts what it is
given — and what it buys is that a reader can see when in a series a
slow sample arrived, which is the difference between a machine that
drifted and a benchmark that is noisy.