mirror of
https://github.com/featurebasedb/featurebase.git
synced 2026-09-07 00:55:55 +00:00
added slice containers type for in memory bitmaps and btree for file based
This commit is contained in:
parent
a159c74498
commit
8a70c4e5a3
4 changed files with 16 additions and 7 deletions
|
|
@ -189,7 +189,7 @@ func (f *Fragment) Open() error {
|
|||
func (f *Fragment) openStorage() error {
|
||||
// Create a roaring bitmap to serve as storage for the slice.
|
||||
if f.storage == nil {
|
||||
f.storage = roaring.NewBitmap()
|
||||
f.storage = roaring.NewBitmapBtree()
|
||||
}
|
||||
// Open the data file to be mmap'd and used as an ops log.
|
||||
file, err := os.OpenFile(f.path, os.O_RDWR|os.O_CREATE|os.O_APPEND, 0666)
|
||||
|
|
|
|||
|
|
@ -5,7 +5,8 @@ import (
|
|||
)
|
||||
|
||||
func TestContainersIterator(t *testing.T) {
|
||||
btc := NewBTreeContainers()
|
||||
//btc := NewBTreeContainers()
|
||||
btc := NewSliceContainers()
|
||||
itr, found := btc.Iterator(0)
|
||||
if found {
|
||||
t.Fatalf("shouldn't have found 0 in empty btc")
|
||||
|
|
|
|||
|
|
@ -113,6 +113,14 @@ type Bitmap struct {
|
|||
|
||||
// NewBitmap returns a Bitmap with an initial set of values.
|
||||
func NewBitmap(a ...uint64) *Bitmap {
|
||||
b := &Bitmap{
|
||||
conts: NewSliceContainers(),
|
||||
}
|
||||
b.Add(a...)
|
||||
return b
|
||||
}
|
||||
|
||||
func NewBitmapBtree(a ...uint64) *Bitmap {
|
||||
b := &Bitmap{
|
||||
conts: NewBTreeContainers(),
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1176,7 +1176,7 @@ const (
|
|||
func BenchmarkContainerLinear(b *testing.B) {
|
||||
|
||||
for n := 0; n < b.N; n++ {
|
||||
bm := roaring.NewBitmap()
|
||||
bm := roaring.NewBitmapBtree()
|
||||
for row := uint64(1); row < NumRows; row++ {
|
||||
for col := uint64(1); col < NumColums; col++ {
|
||||
bm.Add(row*pilosa.SliceWidth + (col * MaxContainerVal))
|
||||
|
|
@ -1187,7 +1187,7 @@ func BenchmarkContainerLinear(b *testing.B) {
|
|||
|
||||
func BenchmarkContainerReverse(b *testing.B) {
|
||||
for n := 0; n < b.N; n++ {
|
||||
bm := roaring.NewBitmap()
|
||||
bm := roaring.NewBitmapBtree()
|
||||
for row := NumRows - 1; row >= 1; row-- {
|
||||
for col := NumColums - 1; col >= 1; col-- {
|
||||
bm.Add(row*pilosa.SliceWidth + (col * MaxContainerVal))
|
||||
|
|
@ -1198,7 +1198,7 @@ func BenchmarkContainerReverse(b *testing.B) {
|
|||
|
||||
func BenchmarkContainerColumn(b *testing.B) {
|
||||
for n := 0; n < b.N; n++ {
|
||||
bm := roaring.NewBitmap()
|
||||
bm := roaring.NewBitmapBtree()
|
||||
for col := uint64(1); col < NumColums; col++ {
|
||||
for row := uint64(1); row < NumRows; row++ {
|
||||
bm.Add(row*pilosa.SliceWidth + (col * MaxContainerVal))
|
||||
|
|
@ -1210,7 +1210,7 @@ func BenchmarkContainerColumn(b *testing.B) {
|
|||
func BenchmarkContainerOutsideIn(b *testing.B) {
|
||||
middle := NumRows / uint64(2)
|
||||
for n := 0; n < b.N; n++ {
|
||||
bm := roaring.NewBitmap()
|
||||
bm := roaring.NewBitmapBtree()
|
||||
|
||||
for col := uint64(1); col < NumColums; col++ {
|
||||
for row := uint64(1); row < middle; row++ {
|
||||
|
|
@ -1224,7 +1224,7 @@ func BenchmarkContainerOutsideIn(b *testing.B) {
|
|||
func BenchmarkContainerInsideOut(b *testing.B) {
|
||||
middle := NumRows / uint64(2)
|
||||
for n := 0; n < b.N; n++ {
|
||||
bm := roaring.NewBitmap()
|
||||
bm := roaring.NewBitmapBtree()
|
||||
for col := uint64(1); col < NumColums; col++ {
|
||||
for row := uint64(1); row <= middle; row++ {
|
||||
bm.Add((middle+row)*pilosa.SliceWidth + (col * MaxContainerVal))
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue