Optimize populated run-optimized BSI query results - #539
Open
perfloop-agent wants to merge 3 commits into
Open
Conversation
perfloop-agent
force-pushed
the
perfloop-pr-open-66gs2g3x13
branch
from
August 4, 2026 02:24
da7ff3d to
aa3338d
Compare
tsenart
force-pushed
the
perfloop-pr-open-66gs2g3x13
branch
from
August 4, 2026 09:09
5268cd3 to
23d4df9
Compare
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
The parallel BSI query paths (
BatchEqual,CompareValue) calledRunOptimizeon every worker-local result bitmap while those bitmaps were still empty, paying per-worker optimization work that can never compress anything. This PR moves run optimization to the populated result:Populated contiguous results keep run compression exactly as before; only the wasted empty-bitmap passes are gone.
Performance
Measured with adjacent before/after builds, fresh benchmark processes, and isolated build caches:
CompareValue end-to-end latency on the same workload was unchanged within noise, and BatchEqual moved ~30 ns/op on a ~1.7 ms operation — no material regression on any probed shape (alternating, sparse-container, single-match, and scattered variants).
Testing
go test ./...andgo test -race ./BitSliceIndexingpass.The branch includes a merge of current master; the only overlap was the shared BSI benchmark/test file, resolved by keeping the superset that contains both the existing
BatchEqualcoverage and the new run-optimized benchmarks.Full verification record: https://app.perfloop.ai/t/oss/case_q4eynnf09a