Skip to main content

BenchConfig

Struct BenchConfig 

Source
pub struct BenchConfig {
    pub min_samples: usize,
    pub max_samples: usize,
    pub short_circuit_samples: usize,
    pub speed_factor: f64,
    pub adaptive: bool,
}
Expand description

Controls how many samples autotune collects per candidate and when candidates are dropped.

Only max_samples and adaptive mean anything to the fixed-count pass; the rest describe elimination, which only the adaptive scheduler performs. Each field says so, because a knob that silently does nothing on the strategy actually running is worse than no knob at all — and adaptive is native-only, so on wasm that is every run.

Fields§

§min_samples: usize

Samples every surviving candidate gets before any elimination happens.

Adaptive only: the fixed-count pass eliminates nothing, so every candidate gets max_samples regardless.

§max_samples: usize

Upper bound on samples collected for a single candidate.

Read by both strategies: the ceiling for the adaptive scheduler, and the flat count for the fixed pass, which has no elimination to spend a smaller budget on.

§short_circuit_samples: usize

Samples that must independently land under the time limit to short circuit.

A short circuit decision is written to the persistent cache and reused on later runs, so it is confirmed rather than taken from a single possibly-lucky sample.

Adaptive only: the fixed pass has the whole sample set in hand before it tests the limit, so it has nothing to confirm.

§speed_factor: f64

How many times slower than the current best a candidate may be before elimination.

Adaptive only. Values below 1.0 are read as 1.0, which eliminates every candidate slower than the leader that the survivor floor allows.

§adaptive: bool

Whether to use the adaptive round robin benchmark instead of a fixed sample count.

Ignored on wasm, which cannot resolve samples between rounds and so always takes the fixed-count pass.

Implementations§

Source§

impl BenchConfig

Every knob is read through an accessor that clamps it into its usable range, so a config file can hold a nonsensical value without any single call site having to remember the repair.

Source

pub fn samples(&self) -> (usize, usize)

The sample budget, clamped so the range is always usable.

Source

pub fn short_circuit_samples(&self) -> usize

How many samples must land under the limit, clamped so a short circuit always needs one.

Source

pub fn speed_factor(&self) -> f64

The elimination threshold, clamped so it can never sit below the leader’s own time.

Trait Implementations§

Source§

impl Clone for BenchConfig

Source§

fn clone(&self) -> BenchConfig

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for BenchConfig

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for BenchConfig

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<'de> Deserialize<'de> for BenchConfig

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Serialize for BenchConfig

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> TuneInputs for T
where T: Clone + Send + Sync + 'static,

Source§

type At<'a> = T

The concrete input type at lifetime 'a.