Skip to content

Commit

Permalink
Merge pull request #403 from Marreck/remove_slice_creation
Browse files Browse the repository at this point in the history
Remove unnecessary slice allocation
  • Loading branch information
lemire authored Oct 4, 2023
2 parents 9384f37 + 2296ac7 commit b947138
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions BitSliceIndexing/bsi.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -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 {

Expand Down Expand Up @@ -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()
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit b947138

Please sign in to comment.