Skip to main content

reuses_candidates

Function reuses_candidates 

Source
fn reuses_candidates(window_keys: &[i64]) -> bool
Expand description

Whether reusing candidates across windows is expected to beat rescanning each one.

Reuse pays off in proportion to how much consecutive windows overlap, and loses to a plain scan on wide windows that barely overlap: maintaining the deque then costs more than the rescan it replaces.

The shape is read from the whole batch rather than from its leading windows. RangeManipulate holds the window duration and the evaluation step fixed, but the sample counts still vary: a series that starts inside the query range gets a first window covering roughly one step. Averages survive that; the first two windows do not.

A wrong answer costs time, not correctness — both evaluators return the same bits.