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: f64c_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: f64c_dist · (|A| + |E|) — approximate plus exact distance computation.
Implementations§
Source§impl QueryCost
impl QueryCost
Sourcepub const HOP_OVERHEAD_S: f64 = 50e-9
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.
Sourcepub fn estimate(
counters: &QueryCounters,
profile: StorageProfile,
cost: DistanceCost,
) -> Self
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.
Sourcepub fn storage_fraction(self) -> f64
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).