Skip to main content

preload_within_budget

Function preload_within_budget 

Source
pub fn preload_within_budget(nnz: usize, what: &str) -> bool
Expand description

Whether a preload of nnz entries fits the budget.

Preloading costs 12 bytes per non-zero (a u64 index and an f32 value), there was no size check anywhere in front of it, and no consumer ever releases it — so at imaging scale a --preload-data was an OOM order, not a request. The budget turns that into a logged skip: every read path already handles the not-preloaded state, it is just slower.

LEGUME_PRELOAD_BUDGET_BYTES overrides the default, following the LEGUME_ZARR_CACHE_CAP precedent for memory knobs.