From 7d746eb67a3137f04cb5b4e2f87fa992a3f9eddb Mon Sep 17 00:00:00 2001 From: Joe Isaacs Date: Fri, 16 Oct 2026 14:27:34 +0100 Subject: [PATCH] perf(scan): bound split searches to the current row range Binary-search sorted chunk starts to the first boundary inside the row range and stop at its end, preserving split-size and tail-folding rules. Signed-off-by: Joe Isaacs --- vortex-layout/src/scan/v2/splits.rs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/vortex-layout/src/scan/v2/splits.rs b/vortex-layout/src/scan/v2/splits.rs index 366d21186a4..d9e044867e4 100644 --- a/vortex-layout/src/scan/v2/splits.rs +++ b/vortex-layout/src/scan/v2/splits.rs @@ -234,9 +234,13 @@ pub(super) fn sparse_filter_split_boundaries( /// and from `rows.end`, as every cut including `rows.start` and `rows.end`. fn cut_at(starts: &[u64], rows: Range, min_rows: u64) -> Vec { let mut cuts = vec![rows.start]; - for &start in starts { + let first = starts.partition_point(|&start| start <= rows.start); + for &start in starts[first..] + .iter() + .take_while(|&&start| start < rows.end) + { let previous = cuts[cuts.len() - 1]; - if rows.start < start && start < rows.end && start - previous >= min_rows { + if start - previous >= min_rows { cuts.push(start); } }