Skip to content

Commit 62cfe44

Browse files
zhulongchengkrasi-georgiev
authored andcommitted
Make Head.symbols map with size hint (prometheus-junkyard#552)
To reduce the number of times the map is resized Signed-off-by: zhulongcheng <[email protected]>
1 parent 921da4d commit 62cfe44

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

head.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -954,7 +954,7 @@ func (h *Head) gc() {
954954
h.postings.Delete(deleted)
955955

956956
// Rebuild symbols and label value indices from what is left in the postings terms.
957-
symbols := make(map[string]struct{})
957+
symbols := make(map[string]struct{}, len(h.symbols))
958958
values := make(map[string]stringset, len(h.values))
959959

960960
if err := h.postings.Iter(func(t labels.Label, _ index.Postings) error {

0 commit comments

Comments
 (0)