From 62cfe4446ff7607f8f2d88a9b62d228bb2bee242 Mon Sep 17 00:00:00 2001 From: zhulongcheng Date: Wed, 20 Mar 2019 16:43:07 +0800 Subject: [PATCH] Make Head.symbols map with size hint (#552) To reduce the number of times the map is resized Signed-off-by: zhulongcheng --- head.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/head.go b/head.go index ea1488713..8ae29689b 100644 --- a/head.go +++ b/head.go @@ -954,7 +954,7 @@ func (h *Head) gc() { h.postings.Delete(deleted) // Rebuild symbols and label value indices from what is left in the postings terms. - symbols := make(map[string]struct{}) + symbols := make(map[string]struct{}, len(h.symbols)) values := make(map[string]stringset, len(h.values)) if err := h.postings.Iter(func(t labels.Label, _ index.Postings) error {