Skip to main content

OidLayout

Enum OidLayout 

Source
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:

variantheaderallocationkeyspace phaseleaf lines touched
Compact24Vec<u8>, align-1 by typeunknown, not 02, sometimes 3
Compact64Alloc2464-aligned242, sometimes 3
Aligned646464-aligned01, 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§

Source§

impl OidLayout

Source

pub const ALL: [OidLayout; 3]

Source

pub const fn header_len(self) -> usize

Source

pub const fn name(self) -> &'static str

Trait Implementations§

Source§

impl Clone for OidLayout

Source§

fn clone(&self) -> OidLayout

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for OidLayout

Source§

impl Debug for OidLayout

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for OidLayout

Source§

fn default() -> OidLayout

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

impl Eq for OidLayout

Source§

impl Hash for OidLayout

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for OidLayout

Source§

fn eq(&self, other: &OidLayout) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for OidLayout

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Allocation for T
where T: RefUnwindSafe + Send + Sync,

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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
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> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.