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: usizeSamples 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: usizeUpper 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: usizeSamples 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: f64How 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: boolWhether 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.
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.
Sourcepub fn samples(&self) -> (usize, usize)
pub fn samples(&self) -> (usize, usize)
The sample budget, clamped so the range is always usable.
Sourcepub fn short_circuit_samples(&self) -> usize
pub fn short_circuit_samples(&self) -> usize
How many samples must land under the limit, clamped so a short circuit always needs one.
Sourcepub fn speed_factor(&self) -> f64
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
impl Clone for BenchConfig
Source§fn clone(&self) -> BenchConfig
fn clone(&self) -> BenchConfig
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for BenchConfig
impl Debug for BenchConfig
Source§impl Default for BenchConfig
impl Default for BenchConfig
Source§impl<'de> Deserialize<'de> for BenchConfigwhere
BenchConfig: Default,
impl<'de> Deserialize<'de> for BenchConfigwhere
BenchConfig: Default,
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Auto Trait Implementations§
impl Freeze for BenchConfig
impl RefUnwindSafe for BenchConfig
impl Send for BenchConfig
impl Sync for BenchConfig
impl Unpin for BenchConfig
impl UnsafeUnpin for BenchConfig
impl UnwindSafe for BenchConfig
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
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