Skip to main content

Regression

Trait Regression 

Source
pub trait Regression: Benchmark<Output: for<'a> Deserialize<'a>> {
    type Tolerances: Input + 'static;
    type Pass: Serialize + Display + 'static;
    type Fail: Serialize + Display + 'static;

    // Required method
    fn check(
        &self,
        tolerances: &Self::Tolerances,
        input: &Self::Input,
        before: &Self::Output,
        after: &Self::Output,
    ) -> Result<PassFail<Self::Pass, Self::Fail>>;
}
Expand description

A refinement of Benchmark, that supports before/after comparison of generated results.

Benchmarks are associated with a “tolerance” input, which may contain runtime values controlling the amount of slack a benchmark is allowed to have between runs before failing.

The semantics of pass or failure are left solely to the discretion of the Regression implementation.

See: register_regression.

Required Associated Types§

Source

type Tolerances: Input + 'static

The tolerance Input associated with this regression check.

Source

type Pass: Serialize + Display + 'static

The report summary used to describe a successful regression check.

Source

type Fail: Serialize + Display + 'static

The report summary used to describe an unsuccessful regression check.

Required Methods§

Source

fn check( &self, tolerances: &Self::Tolerances, input: &Self::Input, before: &Self::Output, after: &Self::Output, ) -> Result<PassFail<Self::Pass, Self::Fail>>

Run any regression checks necessary for two benchmark runs before and after. Argument tolerances contain any tuned runtime tolerances to use when determining whether or not a regression is detected.

The input is the raw input that would have been provided to Benchmark::run when generating the before and after outputs.

Implementations of check should not attempt to print to stdout or any other stream. Instead, all diagnostics should be encoded in the returned PassFail type for reporting upstream.

Implementors§