pub struct KevyMap<K, V> { /* private fields */ }Expand description
An open-addressing Swiss-style hashtable keyed by KevyHash.
Power-of-two capacity (mask = cap - 1); 7/8 load factor; linear probing
over the metadata array; full slots’ (K, V) live AoS in a parallel slot
array of MaybeUninit<(K, V)> co-allocated with the metadata.
When cap == 0 both pointers are dangling and no allocation is held.
Implementations§
Source§impl<K, V> KevyMap<K, V>
impl<K, V> KevyMap<K, V>
Sourcepub fn with_capacity(cap_hint: usize) -> Self
pub fn with_capacity(cap_hint: usize) -> Self
Construct a map sized to hold cap_hint entries without growing
(accounting for the 7/8 load factor).
Sourcepub fn iter_from_bucket(&self, start: usize) -> Iter<'_, K, V> ⓘ
pub fn iter_from_bucket(&self, start: usize) -> Iter<'_, K, V> ⓘ
iter that begins at bucket start (clamped to capacity()) and
walks to the end. To sweep the full ring beginning at a random offset
— the pattern the kevy-store eviction sampler uses — chain it with a
second iter_from_bucket(0) and take(start).
Sourcepub fn prefetch_for_hash(&self, hash: u64)
pub fn prefetch_for_hash(&self, hash: u64)
Hint the CPU to fetch the bucket cache line that a probe at hash
would start at. The prefetch lever against the bucket-probe DRAM
miss: the command-batch driver calls this for command N+1 while
finishing command N, so by the time N+1 actually probes the
metadata, the line is in L1.
No-op when the table is empty. Cheap when not empty (a single
prefetcht0 on x86_64 / prfm pldl1keep on aarch64; a regular
volatile load on other arches via std::intrinsics — but we
only use stable intrinsics here, so non-x86/aarch64 architectures
degrade to a no-op rather than a fake hint).
Source§impl<K, V> KevyMap<K, V>
impl<K, V> KevyMap<K, V>
Trait Implementations§
Source§impl<K: KevyHash + Eq, V> Extend<(K, V)> for KevyMap<K, V>
impl<K: KevyHash + Eq, V> Extend<(K, V)> for KevyMap<K, V>
Source§fn extend<I: IntoIterator<Item = (K, V)>>(&mut self, iter: I)
fn extend<I: IntoIterator<Item = (K, V)>>(&mut self, iter: I)
Source§fn extend_one(&mut self, item: A)
fn extend_one(&mut self, item: A)
extend_one)Source§fn extend_reserve(&mut self, additional: usize)
fn extend_reserve(&mut self, additional: usize)
extend_one)Source§impl<K, Q, V> Index<&Q> for KevyMap<K, V>
m[&q] panics on missing key (matches std::HashMap::Index semantics).
impl<K, Q, V> Index<&Q> for KevyMap<K, V>
m[&q] panics on missing key (matches std::HashMap::Index semantics).