pub struct TailCellMomentCache { /* private fields */ }Expand description
Affine-tail cell-moment memo.
Stand-alone instances (TailCellMomentCache::new()) are useful when a
caller needs deterministic hit/miss bookkeeping that is not polluted by
concurrent traffic on the global memo. The production path uses the
global instance behind evaluate_cell_moments.
All methods take &self: the LRU is internally synchronized (sharded for
the concurrent global memo) and the counters are atomics, so the global
instance needs no outer Mutex. The previous OnceLock<Mutex<…>> wrapper
serialized every tail-cell evaluation across all rayon workers of the
marginal-slope exact-cache build — the same contention class the sharded
per-family cell-moment LRU fix removed.
Implementations§
Source§impl TailCellMomentCache
impl TailCellMomentCache
Sourcepub fn clear(&self)
pub fn clear(&self)
Reset the cache to its empty state. Existing entries are dropped and the hit/miss counters are zeroed.
Sourcepub fn stats(&self) -> TailCellMomentCacheStats
pub fn stats(&self) -> TailCellMomentCacheStats
Snapshot of the cache’s current usage stats.
Sourcepub fn evaluate(
&self,
cell: DenestedCubicCell,
max_degree: usize,
) -> Result<CellMomentState, String>
pub fn evaluate( &self, cell: DenestedCubicCell, max_degree: usize, ) -> Result<CellMomentState, String>
Look up cell at max_degree, computing and inserting the result on
miss. Cells outside the affine-tail keyset bypass the cache and run
the uncached evaluator directly without touching the counters.
Stat semantics: every cache hit increments hits; a miss is
counted when this call computed the value itself. Under concurrent
access two workers racing on the same cold key may both count a miss
(each computes the identical pure-function value); single-threaded
bookkeeping is exact.
Trait Implementations§
Source§impl Debug for TailCellMomentCache
impl Debug for TailCellMomentCache
Auto Trait Implementations§
impl !Freeze for TailCellMomentCache
impl RefUnwindSafe for TailCellMomentCache
impl Send for TailCellMomentCache
impl Sync for TailCellMomentCache
impl Unpin for TailCellMomentCache
impl UnsafeUnpin for TailCellMomentCache
impl UnwindSafe for TailCellMomentCache
Blanket Implementations§
impl<T> Allocation for T
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> DistributionExt for Twhere
T: ?Sized,
impl<T> DistributionExt for Twhere
T: ?Sized,
impl<T, U> Imply<T> for U
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 moreSource§impl<T> Pointable for T
impl<T> Pointable for T
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.