mirror of
https://github.com/prometheus/prometheus.git
synced 2025-07-03 11:03:25 +00:00
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>
This commit is contained in:
parent
975d5d7357
commit
9aa6e041d3
1 changed files with 5 additions and 1 deletions
|
@ -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…
Add table
Add a link
Reference in a new issue