mirror of https://github.com/prometheus/prometheus
MemPostings: allocate ListPostings once in PFALV (#15465)
Same as #15427 but for the new method added in #14144 Instead of allocating each ListPostings one by one, allocate them all in one go. Signed-off-by: Oleg Zaytsev <mail@olegzaytsev.com>pull/15466/head
parent
975d5d7357
commit
9aa6e041d3
|
@ -454,10 +454,14 @@ func (p *MemPostings) PostingsForAllLabelValues(ctx context.Context, name string
|
|||
|
||||
e := p.m[name]
|
||||
its := make([]Postings, 0, len(e))
|
||||
lps := make([]ListPostings, len(e))
|
||||
i := 0
|
||||
for _, refs := range e {
|
||||
if len(refs) > 0 {
|
||||
its = append(its, NewListPostings(refs))
|
||||
lps[i] = ListPostings{list: refs}
|
||||
its = append(its, &lps[i])
|
||||
}
|
||||
i++
|
||||
}
|
||||
|
||||
// Let the mutex go before merging.
|
||||
|
|
Loading…
Reference in New Issue