Skip to main content

FastPathCacheManager

Struct FastPathCacheManager 

Source
pub struct FastPathCacheManager {
    pub caches: [SizeClassCache; 52],
    pub config: FastPathCacheConfig,
    pub fast_path_allocations: usize,
    pub fast_path_deallocations: usize,
    pub slow_path_allocations: usize,
}
Expand description

Thread-local fast-path cache manager.

This structure manages multiple per-size-class caches, allowing threads to satisfy allocation requests from thread-local pools without contention on global allocator structures.

Fields§

§caches: [SizeClassCache; 52]

Per-size-class caches.

§config: FastPathCacheConfig

Configuration for this cache manager.

§fast_path_allocations: usize

Total allocations served from fast-path.

§fast_path_deallocations: usize

Total deallocations through fast-path.

§slow_path_allocations: usize

Fallback allocations (slow path).

Implementations§

Source§

impl FastPathCacheManager

Source

pub fn new() -> FastPathCacheManager

Creates a new fast-path cache manager with default configuration.

Source

pub fn with_config(config: FastPathCacheConfig) -> FastPathCacheManager

Creates a new fast-path cache manager with a custom configuration.

Source

pub fn try_allocate(&mut self, size_class: usize) -> Option<usize>

Attempts to allocate from the fast-path cache for the given size class. Returns Some(index) if successful, None if the cache is disabled or full.

Source

pub fn record_deallocation(&mut self, size_class: usize)

Records a deallocation in the fast-path cache.

Source

pub fn reset_class_cache(&mut self, size_class: usize)

Resets the cache for a specific size class.

Source

pub fn reset_all(&mut self)

Resets all caches.

Source

pub fn class_stats(&self, size_class: usize) -> Option<(usize, u8)>

Returns cache statistics for a specific size class.

Source

pub fn efficiency_metrics(&self) -> FastPathEfficiencyMetrics

Returns overall fast-path cache efficiency metrics.

Trait Implementations§

Source§

impl Default for FastPathCacheManager

Source§

fn default() -> FastPathCacheManager

Returns the “default value” for a type. 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<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, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.