Repository navigation
Fix full-width runs in batched bitmap iteration - #402
perfloop-agent wants to merge 1 commit into
Conversation
Signed-off-by: Perfloop Agent <agent@perfloop.ai> Signed-off-by: Tomás Senart <ts@perfloop.ai>
|
Hi @Kerollmops, I'm Tomás Senart, the human sponsor for this contribution. Perfloop made this change under my sponsorship, and I reviewed the patch and its test evidence before bringing it here. This fixes a correctness problem in batched iteration, not a claimed speedup. A full run contains 65,536 values, but its inclusive length is calculated in u16. That can panic with overflow checks enabled or return no values for that run when checks are disabled. The change widens the difference before adding one, and the regression covers borrowed and owned iterators with several buffer sizes and backward trimming. I'd welcome feedback in plain words, whether it is about the code, the tests, or how this contribution is presented. If something does not fit the project, please say what you would prefer. I will take responsibility for the response and review any follow-up changes. There is no need to learn a special command or use another service to ask for a change. Thanks for taking a look. |
The
next_manyAPI added in #346 can panic or silently lose an untouched full-width run. For example,insert_range(0..=65535)creates one run containing 65,536 values. Reading it into a nonempty batch buffer adds one to the run length inu16before converting tousize. With overflow checks disabled, that count wraps to zero and the run is discarded without returning its values.Convert the endpoint difference to
usizebefore adding one. This represents the full inclusive count while leaving the existing full-run and partial-run advancement paths intact. The change applies to both borrowed and owned bitmap iteration without changing their public APIs.The regression in
roaring/tests/iter_next_many.rschecks one-slot, just-under-full, exact-fit, and oversized buffers, repeated batches, backward trimming, and exhaustion for both iterator forms.Cargo’s batch-iteration integration suite passed 13 tests in each of the default-with-serde, no-default-features, and overflow-checks-disabled configurations, with no failures or skips. Formatting and Clippy checks passed for the affected package.
Case and evidence
Made by Perfloop. Human sponsor: Tomás Senart. To ask for a change, comment or review in plain words. How Perfloop handles pull requests.