RoaringBitmap / RoaringBitmap/roaring
Discussion: allowing pooling of bitmaps
Nobody has claimed this yet.
- Dominant language
- Go
- Stars
- 2.9k
- Forks
- 262
- Avg merge
- 2h 34m
- Merged PRs (30d)
- 8
Description
The current implementation does a lot of allocations so it'd be beneficial to allow pooling of bitmaps. This'd amortise the cost of allocations for long running applications.
Something like:
b := roaring.New()
// do whatever to b
// eventually once you're done with it
b.Reset() // or maybe changing internals of b.Clear()
The motivation for this was this benchmark:
// BenchmarkCachedObject does ~20% more allocs than BenchmarkClone.
func BenchmarkClone(b *testing.B) {
initPL := roaring.New()
for i := 0; i < b.N; i++ {
initPL.Add(uint32(i))
}
b.ResetTimer()
b.ReportAllocs()
for i := 0; i < b.N; i++ {
copy := initPL.Clone()
if copy.GetCardinality() != initPL.GetCardinality() {
b.Error("unequal duplicate size")
}
}
}
func BenchmarkCachedObject(b *testing.B) {
initPL := roaring.New()
for i := 0; i < b.N; i++ {
initPL.Add(uint32(i))
}
copy := roaring.New()
b.ResetTimer()
b.ReportAllocs()
for i := 0; i < b.N; i++ {
copy.Clear()
copy.Or(initPL)
if copy.GetCardinality() != initPL.GetCardinality() {
b.Error("unequal duplicate size")
}
}
}
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reading the roaring.New, Clear, Clone, and Or entry points referenced in the issue, along with the BenchmarkClone and BenchmarkCachedObject examples. Compare their allocation behavior and determine the intended pooling lifecycle. Done means a decided pooling API preserves bitmap correctness while reducing allocations in the benchmark.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- data, performance
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100