pub struct CacheBuster { /* private fields */ }Expand description
Cache-busting buffer — sized to evict L1+L2 on Apple Silicon
(M-series: 192 KB L1d / core, 16 MB L2 shared per cluster).
Borrowed from MAX’s internal_utils/_cache_busting.mojo (#19).
Allocate once, then call .thrash() between bench iterations to
flush whatever the previous iteration left in cache. Without this,
“cache-cold” timings actually measure cache-warm performance and
over-report by 2-5×.
Implementations§
Source§impl CacheBuster
impl CacheBuster
Sourcepub fn new() -> CacheBuster
pub fn new() -> CacheBuster
Allocate a buster sized to evict the targeted cache. Defaults to 32 MB — twice the M-series L2 — which guarantees full L2 eviction. Pass a custom size for finer control (e.g. 256 KB to evict only L1).
pub fn with_bytes(bytes: usize) -> CacheBuster
Trait Implementations§
Source§impl Default for CacheBuster
impl Default for CacheBuster
Source§fn default() -> CacheBuster
fn default() -> CacheBuster
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for CacheBuster
impl RefUnwindSafe for CacheBuster
impl Send for CacheBuster
impl Sync for CacheBuster
impl Unpin for CacheBuster
impl UnsafeUnpin for CacheBuster
impl UnwindSafe for CacheBuster
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
Mutably borrows from an owned value. Read more
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>
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 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>
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