This commit is contained in:
Bryan Boreham 2026-02-03 16:51:14 +00:00 committed by GitHub
commit c85927f120
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -2480,8 +2480,9 @@ func (ev *evaluator) vectorSelectorSingle(it *storage.MemoizedSeriesIterator, of
}
var (
fPointPool zeropool.Pool[[]FPoint]
hPointPool zeropool.Pool[[]HPoint]
fPointPool zeropool.Pool[[]FPoint]
fPoint1Pool zeropool.Pool[[]FPoint]
hPointPool zeropool.Pool[[]HPoint]
// matrixSelectorHPool holds reusable histogram slices used by the matrix
// selector. The key difference between this pool and the hPointPool is that
@ -2492,7 +2493,11 @@ var (
)
func getFPointSlice(sz int) []FPoint {
if p := fPointPool.Get(); p != nil {
if sz == 1 {
if p := fPoint1Pool.Get(); p != nil {
return p
}
} else if p := fPointPool.Get(); p != nil {
return p
}
@ -2507,7 +2512,11 @@ func getFPointSlice(sz int) []FPoint {
// This function is called with an estimated size which often can be over-estimated.
func putFPointSlice(p []FPoint) {
if p != nil {
fPointPool.Put(p[:0])
if cap(p) == 1 {
fPoint1Pool.Put(p[:0])
} else {
fPointPool.Put(p[:0])
}
}
}