Repository navigation
Fix BatchEqual matching after carries beyond 64 bit planes - #586
Open
perfloop-agent wants to merge 2 commits into
Open
perfloop-agent wants to merge 2 commits into
perfloop-agent wants to merge 2 commits into
Conversation
Signed-off-by: Perfloop Agent <agent@perfloop.ai> Signed-off-by: Tomás Senart <ts@perfloop.ai>
Signed-off-by: Perfloop Agent <agent@perfloop.ai> Signed-off-by: Tomás Senart <ts@perfloop.ai>
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.
Description
Fix a regression introduced by our
perfloop-agentcontribution in #532, merged asdac837d3bbc8. ItsBatchEqualbit-plane trie can miss matching columns once arithmetic grows a BSI beyond 64 planes. Atp=64, the runtime maskuint64(1) << uint(p)is zero, so the walk incorrectly requires plane 64 to be clear.This produces
BitCount() == 65andGetValue(1) == (0, true). ForBatchEqual(0, []int64{0}).ToArray(), the #532 parentbd4128breturns[1], while the #532 merge and the current base return[]. This fix restores[1]. Adding an index containing column 1 with value 1 produces the same mismatch.The bug is in the trie path. The large-query scan fallback added by #533 uses
GetValueand was already correct.Type of Change
Changes Made
What was changed?
Why was it changed?
GetValue'sint64result.How was it changed?
Testing
The Go test runner passed the BatchEqual tests in
BitSliceIndexing, includingTestBatchEqualCarryandTestBatchEqualSignedBoundaryCarries; both fail without the fix. They cover theIncrementAllandAddroutes and deterministic differential membership near both signed limits through 65- and 66-plane states.Formatting
The changed Go files are gofmt-clean.
Fuzzing
Not run. The template's
FuzzSmattarget is not defined in the repository, and smat exercises the rootroaringpackage, notBitSliceIndexing.Performance Impact
The existing benchmarks in
BitSliceIndexing/bsi_benchmark_test.goare regression controls, not speedup claims. Both arms include the new tests: the baseline is this PR's head with thebsi.gochange reverted. This keeps the compiled test binaries alike, because adding tests alone changes code layout. An initial comparison against the original test binary measured higher M200 time.Local run with Go 1.24.4: three measured pairs per benchmark after an excluded warmup, randomized arm order, fresh processes, two-second samples and
GOMAXPROCS=4. Benchmark setup stays outside the timed loop. Before/after medians and median paired changes (after minus before):Both increases and decreases are descriptive local estimates, not evidence of a speedup or zero overhead. These controls use normal indexes; carried-index frequency in applications remains unknown.
Local native output from the first measured pair, before then after
With Go 1.24.4, run each benchmark above on the test-only baseline and this revision using its exact name in the selection:
Breaking Changes
None. Values retain
GetValue's low-64-bit interpretation; arithmetic storage andCompareValueare unchanged.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.