Skip to main content

IndexScratch

Struct IndexScratch 

Source
pub struct IndexScratch<Cfg: EGraphConfig> { /* private fields */ }
Expand description

The (key, value) streams the four families are built from, kept alive across rounds.

A round builds a full index and, under semi-naive evaluation, a delta index; both are dropped at the end of the round. The streams are proportional to the node count and to the total arity, so allocating them per build would mean faulting in tens of megabytes eleven times over a saturation of math-microbenchmark. One scratch threaded through the round loop keeps the pages resident and the capacity at the high-water mark.

The stream buffers hold no state between builds: IndexStore::build_with clears them on entry, and the built DenseSpanMaps own copies of what they held. The span arenas are the opposite: they are kept precisely so their allocation and their generation stamp survive, and their leftover content is what the stamp invalidates.

Two index stores are alive at once under semi-naive evaluation (the full index and the round’s delta), so the arenas are kept in two sets of four rather than one: a family’s key space is stable across rounds, so pairing each family with its own arena keeps the table at the size that family needs instead of thrashing it between a 2 M-key and a 100-key build.

An arena is handed out by IndexStore::build_from and comes back through IndexStore::recycle_into. A caller that forgets to recycle loses only the reuse: the next build allocates a fresh arena and is correct, just slower.

Implementations§

Source§

impl<Cfg: EGraphConfig> IndexScratch<Cfg>

Source

pub fn new() -> Self

Source

pub fn arena_capacity(&self) -> usize

Total span-table capacity held across all eight arenas, in entries.

Read by phase_timing so the memory the reuse keeps resident is reported rather than assumed; a recycled table is held for the whole run where a per-build table was freed each round.

Trait Implementations§

Source§

impl<Cfg: EGraphConfig> Default for IndexScratch<Cfg>

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

§

impl<Cfg> Freeze for IndexScratch<Cfg>
where Vec<(usize, <Cfg as EGraphConfig>::G)>: Freeze, Vec<<Cfg as EGraphConfig>::G>: Freeze,

§

impl<Cfg> RefUnwindSafe for IndexScratch<Cfg>
where Vec<(usize, <Cfg as EGraphConfig>::G)>: RefUnwindSafe, Vec<<Cfg as EGraphConfig>::G>: RefUnwindSafe,

§

impl<Cfg> Send for IndexScratch<Cfg>
where Vec<(usize, <Cfg as EGraphConfig>::G)>: Send, Vec<<Cfg as EGraphConfig>::G>: Send,

§

impl<Cfg> Sync for IndexScratch<Cfg>
where Vec<(usize, <Cfg as EGraphConfig>::G)>: Sync, Vec<<Cfg as EGraphConfig>::G>: Sync,

§

impl<Cfg> Unpin for IndexScratch<Cfg>
where Vec<(usize, <Cfg as EGraphConfig>::G)>: Unpin, Vec<<Cfg as EGraphConfig>::G>: Unpin,

§

impl<Cfg> UnsafeUnpin for IndexScratch<Cfg>
where Vec<(usize, <Cfg as EGraphConfig>::G)>: UnsafeUnpin, Vec<<Cfg as EGraphConfig>::G>: UnsafeUnpin,

§

impl<Cfg> UnwindSafe for IndexScratch<Cfg>
where Vec<(usize, <Cfg as EGraphConfig>::G)>: UnwindSafe, Vec<<Cfg as EGraphConfig>::G>: UnwindSafe,

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.