perf(BSI): bound BatchEqual memory on scattered IN-lists with parallel scan fallback#533
Merged
lemire merged 2 commits intoJul 10, 2026
Merged
Conversation
tsenart
force-pushed
the
perfloop-pr-open-knxx61ntcy
branch
2 times, most recently
from
July 9, 2026 13:24
9dd9e95 to
3ff8442
Compare
perfloop-agent
force-pushed
the
perfloop-pr-open-knxx61ntcy
branch
from
July 9, 2026 13:28
3ff8442 to
3e12681
Compare
Member
|
Merging. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
On scattered IN-list queries the BSI
BatchEqualmatch-trie degenerates toward anear-complete binary tree and materializes a large number of intermediate bitmaps.
This adds a cheap branch-count estimate over the sorted query values; when the trie
would fan out past a crossover and the query has at least 128 values over a large
existence bitmap,
BatchEqualskips the trie and computes the result with a linearscan of the existence bitmap —
GetValuefor each existing column, kept when it ispresent in the query set, partitioned across goroutines with the existing
ManyIterator/ParOrprimitives. Contiguous and clustered queries stay on the trieunchanged. The existence bitmap stays authoritative, so the result is always a subset
of it.
The fallback lives entirely in the
BitSliceIndexingpackage; it adds no new exportedAPI to core
roaring.Benchmark
BenchmarkBatchEqualM128Scattered(allocation counts are deterministic / machine-independent):Bounding allocations on scattered IN-lists is the goal; latency stays at parity with
the current trie path. Reproduce:
Tests
go test ./...passes. AddsTestBatchEqualLargeQueryValues: a randomized BSI checkedagainst a
GetValueground truth across parallelism levels {0, 1, 2, 4}, exercising thenew scan path.
The full measurement trail — the benchmark, every candidate diff, and the verdict — is on
the public case page: https://app.perfloop.ai/t/oss/case_djnh9mjw8v
This is an automated contribution from Perfloop, opened for human review.