pub enum OidLayout {
Compact,
Compact64Alloc,
Aligned64,
}Expand description
Where the key array starts, and therefore how the stree keyspace sits
against the 64-byte cache line.
§What this actually controls, and what it does not
stree’s internal B-tree nodes are 8 × i64 = one cache line each, but they
do not live in this section: STree64Mmap builds them into its own
Vec<[i64; 8]>. Nothing in this header can move them. What the section owns
is the leaf layer — the sorted key array that find_exact and
lookup_batch_pipeline linear-scan (up to B + 1 = 9 keys) once the tree has
routed them to a block. So this enum moves exactly one memory access per
lookup: the leaf touch, which is also the coldest one.
A leaf block is 8 * 8 = 64 bytes. Its phase against the line is
keyspace_base mod 64, and keyspace_base is
allocation_base + header_len — which is why one arm is not enough to
separate the two terms:
| variant | header | allocation | keyspace phase | leaf lines touched |
|---|---|---|---|---|
Compact | 24 | Vec<u8>, align-1 by type | unknown, not 0 | 2, sometimes 3 |
Compact64Alloc | 24 | 64-aligned | 24 | 2, sometimes 3 |
Aligned64 | 64 | 64-aligned | 0 | 1, plus the overflow key |
Compact64Alloc is the control that makes the experiment readable: it holds
the allocator constant and moves only the offset, so a difference between it
and Compact is the allocator and a difference between it and Aligned64 is
the phase.
Variants§
Compact
24-byte header, plain Vec<u8>. What every section written before this
enum existed looks like, and the arm every other arm is measured against.
Vec<u8> is align_of::<u8>() == 1 by type. Large allocations happen
to come back 16-byte aligned from glibc, but that is allocator behaviour
and not a guarantee — which is exactly why the aligned arms below cannot
be built by hoping.
Compact64Alloc
24-byte header, 64-aligned allocation. Keyspace at phase 24.
Aligned64
64-byte header, 64-aligned allocation. Keyspace at phase 0 — every
stree leaf block is exactly one cache line.
Implementations§
Trait Implementations§
impl Copy for OidLayout
impl Eq for OidLayout
impl StructuralPartialEq for OidLayout
Auto Trait Implementations§
impl Freeze for OidLayout
impl RefUnwindSafe for OidLayout
impl Send for OidLayout
impl Sync for OidLayout
impl Unpin for OidLayout
impl UnsafeUnpin for OidLayout
impl UnwindSafe for OidLayout
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.