perf: run-optimize roaring bitmaps before persisting - #8688
Open
zhangyue19921010 wants to merge 1 commit into
Open
perf: run-optimize roaring bitmaps before persisting#8688zhangyue19921010 wants to merge 1 commit into
zhangyue19921010 wants to merge 1 commit into
Conversation
Bitmaps holding highly contiguous id sets were serialized without run containers, storing O(elements) bytes where the information content is O(runs): - index fragment bitmaps (fragment ids are allocated monotonically), inlined in the manifest and rewritten on every commit; - overlay coverage bitmaps (physical row offsets; dense overlays cover contiguous ranges), also inlined in the manifest; - compaction-captured row-addr treemaps persisted for deferred index remap (compaction reads whole fragments, so addresses are dense per-fragment ranges). Call optimize() before serializing at each of the three write points. Run containers are part of the standard roaring serialization format, so existing readers decode the new bytes unchanged. A dense 1M-id bitmap shrinks from ~128 KiB to ~230 bytes; incompressible bitmaps are written as before. Tests assert the serialized form is run-length sized (<1% of the unoptimized bitmap; under one byte per address for the treemap) and that it round-trips losslessly.
Contributor
There was a problem hiding this comment.
✅ Gate recommendation: approve.
The change applies run optimization at the three serialization boundaries that own these persisted bitmaps, while preserving caller-visible values and the standard Roaring format. Focused round-trip and size tests cover index metadata, overlay coverage, and compaction capture.
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.
Bitmaps holding highly contiguous id sets were serialized without run containers, storing O(elements) bytes where the information content is O(runs):
Change
Call
optimize()before serializing at each of the three write points:From<&IndexMetadata> for pb::IndexMetadatarust/lance-table/src/format/index.rsserialize_roaring(covers both the protobuf and serde paths)rust/lance-table/src/format/overlay.rsrewrite_filesrust/lance/src/dataset/optimize.rsCompatibility
Run containers are part of the standard roaring serialization format, so existing readers decode the new bytes unchanged. No proto or manifest envelope changes.
Impact
A dense 1M-id bitmap shrinks from ~128 KiB to ~230 bytes (~570x); incompressible bitmaps are written as before (
optimize()only converts a container when the run form is smaller).