Documentation
¶
Index ¶
- func Memclr(b []uint16)
- type Bitmap
- func And(a, b *Bitmap) *Bitmap
- func AndNot(a, b *Bitmap) *Bitmap
- func AndOld(a, b *Bitmap) *Bitmap
- func FastAnd(bitmaps ...*Bitmap) *Bitmap
- func FastOr(bitmaps ...*Bitmap) *Bitmap
- func FastParOr(numGo int, bitmaps ...*Bitmap) *Bitmap
- func FromBuffer(data []byte) *Bitmap
- func FromBufferUnlimited(buf []byte) *Bitmap
- func FromBufferWithCopy(src []byte) *Bitmap
- func FromSortedList(vals []uint64) *Bitmap
- func NewBitmap() *Bitmap
- func NewBitmapWith(numKeys int) *Bitmap
- func Or(a, b *Bitmap) *Bitmap
- func OrOld(a, b *Bitmap) *Bitmap
- func Prefill(maxX uint64) *Bitmap
- func (ra *Bitmap) And(bm *Bitmap) *Bitmap
- func (ra *Bitmap) AndConc(bm *Bitmap, maxConcurrency int) *Bitmap
- func (ra *Bitmap) AndNot(bm *Bitmap) *Bitmap
- func (ra *Bitmap) AndNotConc(bm *Bitmap, maxConcurrency int) *Bitmap
- func (ra *Bitmap) AndNotOld(bm *Bitmap)
- func (ra *Bitmap) AndOld(bm *Bitmap)
- func (ra *Bitmap) Cleanup()
- func (ra *Bitmap) Clone() *Bitmap
- func (ra *Bitmap) CloneToBuf(buf []byte) *Bitmap
- func (dst *Bitmap) CompareNumKeys(src *Bitmap) int
- func (ra *Bitmap) Contains(x uint64) bool
- func (ra *Bitmap) ConvertToBitmapContainers()
- func (ra *Bitmap) Debug(x uint64) string
- func (ra *Bitmap) FillUp(maxX uint64)
- func (ra *Bitmap) GetCardinality() int
- func (ra *Bitmap) IsEmpty() bool
- func (ra *Bitmap) LenInBytes() int
- func (r *Bitmap) ManyIterator() *ManyItr
- func (ra *Bitmap) Maximum() uint64
- func (ra *Bitmap) Minimum() uint64
- func (bm *Bitmap) NewIterator() *Iterator
- func (bm *Bitmap) NewRangeIterators(numRanges int) []*Iterator
- func (ra *Bitmap) Or(bm *Bitmap) *Bitmap
- func (ra *Bitmap) OrConc(bm *Bitmap, maxConcurrency int) *Bitmap
- func (dst *Bitmap) OrOld(src *Bitmap)
- func (ra *Bitmap) Rank(x uint64) int
- func (ra *Bitmap) Remove(x uint64) bool
- func (ra *Bitmap) RemoveRange(lo, hi uint64)
- func (ra *Bitmap) Reset()
- func (ra *Bitmap) Select(x uint64) (uint64, error)
- func (ra *Bitmap) Set(x uint64) bool
- func (ra *Bitmap) SetMany(vals []uint64)
- func (bm *Bitmap) Split(externalSize func(start, end uint64) uint64, maxSz uint64) []*Bitmap
- func (ra *Bitmap) String() string
- func (ra *Bitmap) ToArray() []uint64
- func (ra *Bitmap) ToBuffer() []byte
- func (ra *Bitmap) ToBufferWithCopy() []byte
- type Iterator
- type ManyItr
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Bitmap ¶
type Bitmap struct {
// contains filtered or unexported fields
}
func FastOr ¶
FastOr would merge given Bitmaps into one Bitmap. This is faster than doing an OR over the bitmaps iteratively.
func FastParOr ¶
FastParOr would group up bitmaps and call FastOr on them concurrently. It would then merge the groups into final Bitmap. This approach is simpler and faster than operating at a container level, because we can't operate on array containers belonging to the same Bitmap concurrently because array containers can expand, leaving no clear boundaries.
If FastParOr is called with numGo=1, it just calls FastOr.
Experiments with numGo=4 shows that FastParOr would be 2x the speed of FastOr, but 4x the memory usage, even under 50% CPU usage. So, use wisely.
func FromBuffer ¶
FromBuffer returns a pointer to bitmap corresponding to the given buffer. This bitmap shouldn't be modified because it might corrupt the given buffer.
func FromBufferUnlimited ¶ added in v0.0.10
FromBufferUnlimited returns a pointer to bitmap corresponding to the given buffer. Entire buffer capacity is utlized for future bitmap modifications and expansions.
func FromBufferWithCopy ¶
FromBufferWithCopy creates a copy of the given buffer and returns a bitmap based on the copied buffer. This bitmap is safe for both read and write operations.
func FromSortedList ¶
func NewBitmapWith ¶
func (*Bitmap) AndConc ¶ added in v0.0.9
AndConc performs And merge concurrently. Concurrency is calculated based on number of internal containers in destination bitmap, so that each goroutine handles at least [minContainersPerRoutine] containers. maxConcurrency limits concurrency calculated internally. If maxConcurrency <= 0, then calculated concurrency is not limited.
E.g.: dst bitmap has 100 containers. Internal concurrency = 100/24 = 4. For: - maxConcurrency = 2, there will be 2 goroutines executed - maxConcurrency = 6, there will be 4 goroutines executed
func (*Bitmap) AndNotConc ¶ added in v0.0.9
AndNotConc performs AndNot merge concurrently. Concurrency is calculated based on number of internal containers in source bitmap, so that each goroutine handles at least [minContainersPerRoutine] containers. maxConcurrency limits concurrency calculated internally. If maxConcurrency <= 0, then calculated concurrency is not limited.
E.g.: src bitmap has 100 containers. Internal concurrency = 100/24 = 4. For: - maxConcurrency = 2, there will be 2 goroutines executed - maxConcurrency = 6, there will be 4 goroutines executed
func (*Bitmap) CloneToBuf ¶ added in v0.0.9
func (*Bitmap) CompareNumKeys ¶ added in v0.0.9
func (*Bitmap) ConvertToBitmapContainers ¶ added in v0.0.3
func (ra *Bitmap) ConvertToBitmapContainers()
func (*Bitmap) FillUp ¶ added in v0.0.9
FillUp fill bitmap with elements (maximum-maxX], where maximum means last element. If bitmap is empty then [0-maxX] elements are added (reusing underlying data slice if big enough to fit all elements). If last element is >= than given maxX nothing is done.
func (*Bitmap) GetCardinality ¶
func (*Bitmap) LenInBytes ¶ added in v0.0.9
func (*Bitmap) ManyIterator ¶
TODO: See if this is needed, we should remove this
func (*Bitmap) NewIterator ¶
func (*Bitmap) NewRangeIterators ¶
func (*Bitmap) OrConc ¶ added in v0.0.9
OrConc performs Or merge concurrently. Concurrency is calculated based on number of internal containers in source bitmap, so that each goroutine handles at least [minContainersPerRoutine] containers. maxConcurrency limits concurrency calculated internally. If maxConcurrency <= 0, then calculated concurrency is not limited.
E.g.: src bitmap has 100 containers. Internal concurrency = 100/24 = 4. For: - maxConcurrency = 2, there will be 2 goroutines executed - maxConcurrency = 6, there will be 4 goroutines executed
func (*Bitmap) RemoveRange ¶
Remove range removes [lo, hi) from the bitmap.
func (*Bitmap) Split ¶
Split splits the bitmap based on maxSz and the externalSize function. It splits the bitmap such that size of each split bitmap + external size corresponding to its elements approximately equal to maxSz (it can be greater than maxSz sometimes). The splits are returned in sorted order. externalSize is a function that should return the external size corresponding to elements in range [start, end]. External size is used to calculate the split boundaries.