app/vmselect/promql: pre-allocate memory for values to be merged in mergeTimeseries()

This should reduce the number of memory re-allocations
This commit is contained in:
Aliaksandr Valialkin 2023-01-09 22:51:14 -08:00
parent 645c24dc5f
commit 30ed33fae0
No known key found for this signature in database
GPG key ID: A72BEC6CD3D0DED1

View file

@ -525,6 +525,7 @@ func mergeTimeseries(a, b []*timeseries, bStart int64, ec *EvalConfig) []*timese
var tmp timeseries
tmp.denyReuse = true
tmp.Timestamps = sharedTimestamps
tmp.Values = make([]float64, 0, len(tmp.Timestamps))
tmp.MetricName.MoveFrom(&tsA.MetricName)
tmp.Values = append(tmp.Values, tsA.Values...)