package sroar
import "github.com/dgraph-io/sroar"
Index ¶
- func Memclr(b []uint16)
- type Bitmap
- func And(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 FromBufferWithCopy(src []byte) *Bitmap
- func FromSortedList(vals []uint64) *Bitmap
- func NewBitmap() *Bitmap
- func NewBitmapWith(numKeys int) *Bitmap
- func Or(a, b *Bitmap) *Bitmap
- func (ra *Bitmap) And(bm *Bitmap)
- func (ra *Bitmap) AndNot(bm *Bitmap)
- func (ra *Bitmap) Cleanup()
- func (ra *Bitmap) Clone() *Bitmap
- func (ra *Bitmap) Contains(x uint64) bool
- func (ra *Bitmap) Debug(x uint64) string
- func (ra *Bitmap) GetCardinality() int
- func (ra *Bitmap) IsEmpty() bool
- 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 (dst *Bitmap) Or(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
Functions ¶
func Memclr ¶
func Memclr(b []uint16)
Types ¶
type Bitmap ¶
type Bitmap struct {
// contains filtered or unexported fields
}
func And ¶
func FastAnd ¶
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 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 NewBitmap ¶
func NewBitmap() *Bitmap
func NewBitmapWith ¶
func Or ¶
func (*Bitmap) And ¶
func (*Bitmap) AndNot ¶
func (*Bitmap) Cleanup ¶
func (ra *Bitmap) Cleanup()
func (*Bitmap) Clone ¶
func (*Bitmap) Contains ¶
func (*Bitmap) Debug ¶
func (*Bitmap) GetCardinality ¶
func (*Bitmap) IsEmpty ¶
func (*Bitmap) ManyIterator ¶
TODO: See if this is needed, we should remove this
func (*Bitmap) Maximum ¶
func (*Bitmap) Minimum ¶
func (*Bitmap) NewIterator ¶
func (*Bitmap) NewRangeIterators ¶
func (*Bitmap) Or ¶
TODO: Check if we want to use lazyMode
func (*Bitmap) Rank ¶
func (*Bitmap) Remove ¶
func (*Bitmap) RemoveRange ¶
Remove range removes [lo, hi) from the bitmap.
func (*Bitmap) Reset ¶
func (ra *Bitmap) Reset()
func (*Bitmap) Select ¶
Select returns the element at the xth index. (0-indexed)
func (*Bitmap) Set ¶
func (*Bitmap) SetMany ¶
TODO: Potentially this can be optimized.
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.
func (*Bitmap) String ¶
func (*Bitmap) ToArray ¶
func (*Bitmap) ToBuffer ¶
func (*Bitmap) ToBufferWithCopy ¶
type Iterator ¶
type Iterator struct {
// contains filtered or unexported fields
}
func (*Iterator) Next ¶
type ManyItr ¶
type ManyItr struct {
// contains filtered or unexported fields
}
func (*ManyItr) NextMany ¶
Source Files ¶
bitmap.go container.go iterator.go keys.go setutil.go utils.go
- Version
- v0.0.0-20220527172339-b92b7eaaf6e0 (latest)
- Published
- May 27, 2022
- Platform
- linux/amd64
- Imports
- 10 packages
- Last checked
- 2 months ago –
Tools for package owners.