perf: speed up fresh Bitmap.Or sorted interleaved source-only high-key inserts#535
Open
perfloop-agent wants to merge 1 commit into
Open
perf: speed up fresh Bitmap.Or sorted interleaved source-only high-key inserts#535perfloop-agent wants to merge 1 commit into
perfloop-agent wants to merge 1 commit into
Conversation
…y inserts Signed-off-by: Perfloop Agent <agent@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
Speed up the measured fresh-receiver, sorted interleaved/source-only high-key insertion shapes in
Bitmap.Or, without changing the public API or intended bitmap semantics. No general latency improvement is claimed for the measured fresh-overlap, single-interior, or tail-adjacent shapes.Type of Change
Changes Made
What was changed?
Bitmap.Orhigh-key suffixes.Why was it changed?
How was it changed?
getUnionedWritableContainerpath and source-container COW/clone ownership rules.Testing
Recorded checks passed:
pairing,environment_consistent,baseline_valid,benchmark_passed,bulk-merge-semantics-and-ownership,bitmap-or-profile-boundary,all-go-packages,gofmt-simplify,unconvert,bulk-merge-tail-ownership-and-unordered-fallback,malformed-metadata-forward-fallback,measurements_sane,metric_present,sample_sufficiency, andsample_independence.The package-suite check was
go test -count=1 ./.... The focused semantic check wasgo test -count=1 -run '^TestBitmapOrBulkMerge' ..Formatting
The recorded
gofmt-simplifyandunconvertchecks passed.Fuzzing
Not run in this case; no fuzzing result is claimed as PR evidence.
Performance Impact
For the primary measured fresh-receiver 4,096-container sorted interleaved/source-only workload,
ns/opimproved from 6,864,674 to 999,185.5: 85.4445% lower, n=10 per arm, p=1.08251e-05.The benchmark fixture was authored for this case. The baseline was re-measured interleaved with candidate
8d782a0b121115c2b10a286024120b0e53ba71b7against44559cd5c0e01050eb7ee87feb73a1b6ee90cf43onlinux/amd64,go1.26.4,-cpu=1. Every entry below is a labelled baseline → candidate pair, with n=10 per arm.BenchmarkBitmapOrBulkMerge/fresh-append-only-4096— guardrail heldBenchmarkBitmapOrBulkMerge/fresh-copy-on-write-interleaved-4096— guardrail heldBenchmarkBitmapOrBulkMerge/fresh-interleaved-1024— guardrail heldBenchmarkBitmapOrBulkMerge/fresh-interleaved-4096— primaryns/opwon; allocation guardrails heldBenchmarkBitmapOrBulkMerge/fresh-interleaved-64— guardrail heldBenchmarkBitmapOrBulkMerge/fresh-interleaved-65— guardrail heldBenchmarkBitmapOrBulkMerge/fresh-overlap-4096— guardrail heldBenchmarkBitmapOrBulkMerge/fresh-single-interior-4096— guardrail heldBenchmarkBitmapOrBulkMergeTailAdjacent/fresh-single-interior-4096—ns/opunconfirmed; B/op and allocs/op guardrails heldSeven selector-level latency guardrails held. The tail-adjacent latency guard is unconfirmed and not statistically significant, rather than a claimed win or held guardrail. The primary workload's
B/opandallocs/opseries are guardrails; their before/after values are reported above, not presented as additional primary wins.Trade-off: the sorted fast path performs a sortedness validation before planned placement. If validation declines, the operation uses the existing forward path.
From a clean checkout with ordinary Go tooling, reproduce the primary native benchmark at each revision as follows:
Run the command ten times per worktree for the reported sample count.
Breaking Changes
Related Issues
Additional Notes
Implementation changes are in
roaring.goandroaringarray.go; focused semantic coverage and benchmark fixtures are inbitmap_or_bulk_merge_test.go,bitmap_or_bulk_merge_regression_test.go, andbitmap_or_bulk_merge_tail_adjacent_bench_test.go.Prior proof revisions
cand_e0zxpjxk2v(2f2d608433f840ff255aa009ce4d50534a4a6366) andcand_mee63wmm3f(a44478d8630cc6ded6d1eaa952a38237dda5b9d7) were inconclusive.cand_qnfnmn9d4z(ea59f145a1bdb72dfddc91aa210e027842eb60f1) andcand_9664d2j0de(c88ff333991cc76ae6072cc11cac5cd74a5e0c10) were validated proof-hardening revisions. The final candidate only clarifies the nested tail-adjacent benchmark leaf name while retaining the sealed compatibility selector.Full proof: https://app.perfloop.ai/t/oss/case_jyvmgdg1pq
This is an automated, human-reviewed Perfloop contribution opened by perfloop-agent. The body links to reproducible proof for the change. The change was benchmarked on perfloop/roaring, an automation fork of RoaringBitmap/roaring; the commit on this PR's head branch carries the proof.
Assisted-by: PerfloopAgent:gpt-5.6-terra