Skip to content

Commit

Permalink
Use non sparse HLL to avoid allocations
Browse files Browse the repository at this point in the history
  • Loading branch information
jeschkies committed Dec 27, 2024
1 parent 22835ff commit 448aafe
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
3 changes: 1 addition & 2 deletions pkg/logql/count_min_sketch.go
Original file line number Diff line number Diff line change
Expand Up @@ -241,9 +241,8 @@ func (v *HeapCountMinSketchVector) Push(x any) {
func (v *HeapCountMinSketchVector) Pop() any {
old := v.Metrics
n := len(old)
x := old[n-1]
v.Metrics = old[0 : n-1]
return x
return old[n-1]
}

// JoinCountMinSketchVector joins the results from stepEvaluator into a CountMinSketchVector.
Expand Down
2 changes: 1 addition & 1 deletion pkg/logql/sketch/cms.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ func NewCountMinSketch(w, d uint32) (*CountMinSketch, error) {
Depth: d,
Width: w,
Counters: make2dslice(w, d),
HyperLogLog: hyperloglog.New16(),
HyperLogLog: hyperloglog.New16NoSparse(),
}, nil
}

Expand Down

0 comments on commit 448aafe

Please sign in to comment.