pub struct CpuPlanCache { /* private fields */ }Expand description
A shareable, bounded cache of immutable CPU numerical plans.
Cloning the handle shares the cache. The lock inside is held only while a plan is looked up or inserted, never while a computation runs on it.
§Examples
use tenferro_cpu::{CpuEngine, CpuPlanCache};
let plans = CpuPlanCache::new();
let first = CpuEngine::serial().with_plan_cache(plans.clone());
let second = CpuEngine::serial().with_plan_cache(plans.clone());
assert!(first.plan_cache().shares_with(second.plan_cache()));
assert_eq!(plans.stats().entries, 0);Implementations§
Source§impl CpuPlanCache
impl CpuPlanCache
Sourcepub fn new() -> Self
pub fn new() -> Self
An empty cache with the default bounds.
§Examples
let plans = tenferro_cpu::CpuPlanCache::new();
assert_eq!(plans.stats().entries, 0);Whether other is a handle to the same cache.
§Examples
let plans = tenferro_cpu::CpuPlanCache::new();
assert!(plans.shares_with(&plans.clone()));
assert!(!plans.shares_with(&tenferro_cpu::CpuPlanCache::new()));Sourcepub fn stats(&self) -> CacheStats
pub fn stats(&self) -> CacheStats
Combined statistics of every plan family.
§Examples
assert_eq!(tenferro_cpu::CpuPlanCache::new().stats().hits, 0);Sourcepub fn contraction_stats(&self) -> CacheStats
pub fn contraction_stats(&self) -> CacheStats
Statistics of the contraction-plan family alone.
§Examples
assert_eq!(tenferro_cpu::CpuPlanCache::new().contraction_stats().entries, 0);Sourcepub fn indexed_stats(&self) -> CacheStats
pub fn indexed_stats(&self) -> CacheStats
Statistics of the indexed-traversal family alone.
§Examples
assert_eq!(tenferro_cpu::CpuPlanCache::new().indexed_stats().entries, 0);Sourcepub fn clear(&self)
pub fn clear(&self)
Drop every retained plan.
§Examples
let plans = tenferro_cpu::CpuPlanCache::new();
plans.clear();
assert_eq!(plans.stats().entries, 0);Sourcepub fn clear_indexed(&self)
pub fn clear_indexed(&self)
Drop every retained indexed-traversal plan.
§Examples
let plans = tenferro_cpu::CpuPlanCache::new();
plans.clear_indexed();
assert_eq!(plans.indexed_stats().entries, 0);Sourcepub fn contraction_capacity(&self) -> usize
pub fn contraction_capacity(&self) -> usize
Maximum number of retained contraction plans.
§Examples
let plans = tenferro_cpu::CpuPlanCache::new();
plans.set_contraction_capacity(8);
assert_eq!(plans.contraction_capacity(), 8);Sourcepub fn set_contraction_capacity(&self, max_plans: usize)
pub fn set_contraction_capacity(&self, max_plans: usize)
Bound the number of retained contraction plans.
§Examples
let plans = tenferro_cpu::CpuPlanCache::new();
plans.set_contraction_capacity(0);
assert_eq!(plans.contraction_capacity(), 0);Sourcepub fn indexed_limits(&self) -> IndexedPlanCacheLimits
pub fn indexed_limits(&self) -> IndexedPlanCacheLimits
Bounds of the indexed-traversal family.
§Examples
let plans = tenferro_cpu::CpuPlanCache::new();
let limits = plans.indexed_limits();
plans.set_indexed_limits(limits);
assert_eq!(plans.indexed_limits(), limits);Sourcepub fn set_indexed_limits(&self, limits: IndexedPlanCacheLimits)
pub fn set_indexed_limits(&self, limits: IndexedPlanCacheLimits)
Replace the bounds of the indexed-traversal family, evicting as needed.
§Examples
let plans = tenferro_cpu::CpuPlanCache::new();
plans.set_indexed_limits(plans.indexed_limits());Trait Implementations§
Source§impl Clone for CpuPlanCache
impl Clone for CpuPlanCache
Source§fn clone(&self) -> CpuPlanCache
fn clone(&self) -> CpuPlanCache
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for CpuPlanCache
impl Debug for CpuPlanCache
Auto Trait Implementations§
impl Freeze for CpuPlanCache
impl RefUnwindSafe for CpuPlanCache
impl Send for CpuPlanCache
impl Sync for CpuPlanCache
impl Unpin for CpuPlanCache
impl UnsafeUnpin for CpuPlanCache
impl UnwindSafe for CpuPlanCache
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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> ⓘ
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