Skip to main content

QueryCost

Struct QueryCost 

Source
pub struct QueryCost {
    pub traversal_s: f64,
    pub storage_access_s: f64,
    pub distance_s: f64,
}
Expand description

The three-term query-cost decomposition, in seconds.

Produced by QueryCost::estimate, which prices a set of QueryCounters against a StorageProfile and a DistanceCost. The point of keeping the terms separate (rather than only their sum) is that the storage-aware claims are about how a change shifts cost between terms — e.g. a narrower dtype moves cost out of storage_access_s, a larger approximate gate moves cost out of storage_access_s and into distance_s.

Fields§

§traversal_s: f64

c_hop · |V| — best-first bookkeeping over visited nodes (RAM-bound).

§storage_access_s: f64

Σ (t_seek + bytes/B_seq) — physical reads. The term prior work assumes uniform; the dominant term on HDD-class media.

§distance_s: f64

c_dist · (|A| + |E|) — approximate plus exact distance computation.

Implementations§

Source§

impl QueryCost

Source

pub const HOP_OVERHEAD_S: f64 = 50e-9

Per-visited-node traversal overhead, in seconds.

Best-first bookkeeping (queue ops, adjacency expansion, visited-set maintenance) is small and RAM-bound; this is a representative constant, not a tuned value. Traversal is intentionally the cheap term in the storage-aware regime.

Source

pub fn estimate( counters: &QueryCounters, profile: StorageProfile, cost: DistanceCost, ) -> Self

Price counters against a storage profile and distance cost.

Storage access is modelled as one seek per seeks counted plus transfer of bytes_read at the medium’s sequential bandwidth — so a query that coalesces its reads into fewer seeks (via layout + scheduling) is priced strictly lower at equal bytes, which is the behaviour the paradigm predicts and the scheduler is built to produce.

Source

pub fn total_s(self) -> f64

Total modelled query latency: the sum of the three terms.

Source

pub fn storage_fraction(self) -> f64

Fraction of total cost attributable to storage access, in [0, 1].

A diagnostic for which regime a query is in: near 1 means the query is storage-bound (the paradigm’s target regime), near 0 means it is compute- or traversal-bound (the classical in-RAM regime).

Trait Implementations§

Source§

impl Clone for QueryCost

Source§

fn clone(&self) -> Self

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 QueryCost

Source§

impl Debug for QueryCost

Source§

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

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

impl<'de> Deserialize<'de> for QueryCost

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl PartialEq for QueryCost

Source§

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

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

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

Inequality operator !=. Read more
Source§

impl Serialize for QueryCost

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for QueryCost

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> 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<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

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> 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 = !

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.