From 2296ac72bb61bfab12e83db22f6058edaa030edf Mon Sep 17 00:00:00 2001 From: Marreck Date: Tue, 3 Oct 2023 23:35:08 +0200 Subject: [PATCH] Remove unnecessary slice allocation --- BitSliceIndexing/bsi.go | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/BitSliceIndexing/bsi.go b/BitSliceIndexing/bsi.go index b71fa49a..168aa288 100644 --- a/BitSliceIndexing/bsi.go +++ b/BitSliceIndexing/bsi.go @@ -94,8 +94,7 @@ func (b *BSI) SetValue(columnID uint64, value int64) { // If max/min values are set to zero then automatically determine bit array size if b.MaxValue == 0 && b.MinValue == 0 { - ba := make([]*roaring.Bitmap, bits.Len64(uint64(value))) - for i := len(ba) - b.BitCount(); i > 0; i-- { + for i := bits.Len64(uint64(value)) - b.BitCount(); i > 0; i-- { b.bA = append(b.bA, roaring.NewBitmap()) if b.runOptimized { b.bA[i].RunOptimize() @@ -264,7 +263,6 @@ type task struct { // For the RANGE parameter the comparison criteria is >= valueOrStart and <= end. // The parallelism parameter indicates the number of CPU threads to be applied for processing. A value // of zero indicates that all available CPU resources will be potentially utilized. -// func (b *BSI) CompareValue(parallelism int, op Operation, valueOrStart, end int64, foundSet *roaring.Bitmap) *roaring.Bitmap { @@ -524,7 +522,6 @@ func (b *BSI) minOrMax(op Operation, batch []uint32, resultsChan chan int64, wg // Sum all values contained within the foundSet. As a convenience, the cardinality of the foundSet // is also returned (for calculating the average). -// func (b *BSI) Sum(foundSet *roaring.Bitmap) (sum int64, count uint64) { count = foundSet.GetCardinality() @@ -800,7 +797,6 @@ func (b *BSI) addDigit(foundSet *roaring.Bitmap, i int) { // contained within the input BSI. Given that for BSIs, different columnIDs can have the same value. TransposeWithCounts // is useful for situations where there is a one-to-many relationship between the vectored integer sets. The resulting BSI // contains the number of times a particular value appeared in the input BSI as an integer count. -// func (b *BSI) TransposeWithCounts(parallelism int, foundSet *roaring.Bitmap) *BSI { return parallelExecutorBSIResults(parallelism, b, transposeWithCounts, foundSet, true)