pub struct MemoryBudget(/* private fields */);Expand description
An upper bound on the memory used for buffering scores.
This governs how much scored output is held at once, which is the part of the footprint that scales with the genome. It does not cover the sequence of the record being read: without an index the FASTA reader hands over a whole record at a time, so the largest record’s sequence is a floor that a budget cannot lower.
Implementations§
Source§impl MemoryBudget
impl MemoryBudget
pub fn bytes(&self) -> u64
Sourcepub fn chunk_scores(&self, threads: usize, cap: usize) -> usize
pub fn chunk_scores(&self, threads: usize, cap: usize) -> usize
How many scores one chunk should produce, given the number of worker threads.
Each thread holds one chunk’s scores while working, so the in-flight cost is
threads * chunk_scores * 8 bytes. The result is capped at cap because past a
point larger chunks only reduce parallelism, and floored so that a very small
budget degrades rather than grinding to a halt.
Source§impl MemoryBudget
impl MemoryBudget
Sourcepub fn window_bases(&self, cap: usize) -> usize
pub fn window_bases(&self, cap: usize) -> usize
How many bases of sequence to hold at once when reading through an index.
The window is the sequence side of the footprint, so it gets a share of the budget separate from the score buffers, and is capped because past a point a larger window only costs memory without saving reads.
Trait Implementations§
Source§impl Clone for MemoryBudget
impl Clone for MemoryBudget
Source§fn clone(&self) -> MemoryBudget
fn clone(&self) -> MemoryBudget
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for MemoryBudget
Source§impl Debug for MemoryBudget
impl Debug for MemoryBudget
Source§impl Display for MemoryBudget
impl Display for MemoryBudget
impl Eq for MemoryBudget
Source§impl FromStr for MemoryBudget
impl FromStr for MemoryBudget
Source§fn from_str(s: &str) -> Result<Self, Self::Err>
fn from_str(s: &str) -> Result<Self, Self::Err>
Parse a size such as 8G, 512M, 64K or 1048576.
Suffixes are binary: 8G is 8 * 1024^3. KB/KiB spellings are accepted and
mean the same thing, since offering both binary and decimal units under names
that differ by one letter invites mistakes.
Source§type Err = ParseBudgetError
type Err = ParseBudgetError
Source§impl PartialEq for MemoryBudget
impl PartialEq for MemoryBudget
Source§fn eq(&self, other: &MemoryBudget) -> bool
fn eq(&self, other: &MemoryBudget) -> bool
self and other values to be equal, and is used by ==.impl StructuralPartialEq for MemoryBudget
Auto Trait Implementations§
impl Freeze for MemoryBudget
impl RefUnwindSafe for MemoryBudget
impl Send for MemoryBudget
impl Sync for MemoryBudget
impl Unpin for MemoryBudget
impl UnsafeUnpin for MemoryBudget
impl UnwindSafe for MemoryBudget
Blanket Implementations§
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more