mirror of
https://github.com/prometheus/prometheus.git
synced 2025-01-30 23:20:51 -08:00
Make Head.symbols map with size hint (#552)
To reduce the number of times the map is resized Signed-off-by: zhulongcheng <zhulongcheng.me@gmail.com>
This commit is contained in:
parent
921da4dced
commit
62cfe4446f
2
head.go
2
head.go
|
@ -954,7 +954,7 @@ func (h *Head) gc() {
|
||||||
h.postings.Delete(deleted)
|
h.postings.Delete(deleted)
|
||||||
|
|
||||||
// Rebuild symbols and label value indices from what is left in the postings terms.
|
// 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))
|
values := make(map[string]stringset, len(h.values))
|
||||||
|
|
||||||
if err := h.postings.Iter(func(t labels.Label, _ index.Postings) error {
|
if err := h.postings.Iter(func(t labels.Label, _ index.Postings) error {
|
||||||
|
|
Loading…
Reference in a new issue