Skip to main content

should_use_sparse_path

Function should_use_sparse_path 

Source
pub fn should_use_sparse_path(count: usize, nrows: usize) -> bool
Expand description

Density rule for picking interpret_sparse over interpret.

Below ~25% density the random-access gather over existing_indices beats the sequential column scan: each Cmp opcode does ~count scattered loads vs ~nrows sequential loads, and the sequential streaming-prefetch advantage is roughly 4× per byte on modern x86. Empirical break-even tracked the 25% boundary closely on the bench_density_crossover workload, so we encode it directly as count * 4 < nrows (integer-only — no float density boundary, per the determinism contract).