Skip to content

Commit e79cbc3

Browse files
committed
Create rewriting map with maximum capacity
By doing this we avoid having to regrow the map, which improves CPU and memory consumption.
1 parent 4ff94ee commit e79cbc3

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

pkg/phlaredb/symdb/dedup_slice.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,7 @@ func (s *deduplicatingSlice[M, K, H]) Size() uint64 {
254254

255255
func (s *deduplicatingSlice[M, K, H]) ingest(elems []M, rewriter *rewriter) {
256256
var (
257-
rewritingMap = make(map[int64]int64)
257+
rewritingMap = make(map[int64]int64, len(elems))
258258
missing = int64SlicePool.Get()
259259
)
260260
missing = missing[:0]

0 commit comments

Comments
 (0)