Repository navigation
Document that RunOptimize recovers space after modifying run containers - #577
Merged
Merged
Conversation
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.
Some operations that modify a bitmap, such as
AddRangeandRemoveRange, do not always convert a run container back to an array or bitmap container when the runs stop being the most compact encoding. In the worst case, the runs of one 65536-value chunk take about 128 KiB where a bitmap container takes 8 KiB. CallingRunOptimizeagain recovers that space. This is the Go counterpart of RoaringBitmap/RoaringBitmap#886. See also RoaringBitmap/RoaringBitmap#879.Measured on
master:RunOptimizeRemoveRange(i, i+1)for every eveniAddRange(0, 100), thenAddRange(i, i+1)for every evenifrom 200RemoveRangecase withroaring64Single-value
AddandRemovealready keep containers minimal, so the documentation does not name them.Changes
RunOptimizeonroaring.Bitmapandroaring64.Bitmap, and on both BSI types, which refer toBitmap.RunOptimize.roaringandroaring64checking thatRunOptimizeshrinks such a bitmap more than tenfold without changing its contents.go test ./...passes andgofmtis clean.