pub struct Change {
pub bench: String,
pub tool: String,
pub runner: String,
pub metric: String,
pub base: f64,
pub head: f64,
}Expand description
One metric, on one series, on both sides.
Fields§
§bench: String§tool: String§runner: String§metric: String§base: f64§head: f64Implementations§
Source§impl Change
impl Change
Sourcepub fn pct(&self) -> Option<f64>
pub fn pct(&self) -> Option<f64>
Change as a percentage of the base, or None when the base is zero.
None rather than 0.0. Returning zero was worse than imprecise: the
gate compares this against the threshold, so a rise from a zero baseline
read as no change at all and passed silently, however large the head.
A percentage of nothing is undefined, and the type should say so.
Sourcepub fn exceeds(&self, gate: &Gate) -> bool
pub fn exceeds(&self, gate: &Gate) -> bool
Has this risen beyond gate’s threshold?
Both limits have to be crossed: the percentage and the absolute floor. The floor is for the benchmarks a percentage serves worst. On a 450k-instruction startup check, 1% is 4,500 instructions — a new dependency’s relocations in the dynamic loader rather than anything the program did — while the same 1% of a 100M-instruction install is a million instructions of real work.
From a zero base, any increase past the floor counts. There is no percentage that means anything against zero, and passing would be the one outcome that is certainly wrong.
Whether the gate is enabled is not this function’s question: a report-only series is still held to its threshold, so the report can say that it crossed one.