mirror of
https://github.com/VictoriaMetrics/VictoriaMetrics.git
synced 2024-12-15 00:13:30 +01:00
app/vmselect/netstorage: properly pre-allocate space for sbs
This commit is contained in:
parent
89d652b583
commit
0468cdf33e
@ -264,7 +264,8 @@ func (pts *packedTimeseries) Unpack(tbf *tmpBlocksFile, dst *Result, tr storage.
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Feed workers with work
|
// Feed workers with work
|
||||||
upws := make([]*unpackWork, 0, 1+len(pts.addrs)/unpackBatchSize)
|
addrsLen := len(pts.addrs)
|
||||||
|
upws := make([]*unpackWork, 0, 1+addrsLen/unpackBatchSize)
|
||||||
upw := getUnpackWork()
|
upw := getUnpackWork()
|
||||||
upw.tbf = tbf
|
upw.tbf = tbf
|
||||||
upw.fetchData = fetchData
|
upw.fetchData = fetchData
|
||||||
@ -288,7 +289,7 @@ func (pts *packedTimeseries) Unpack(tbf *tmpBlocksFile, dst *Result, tr storage.
|
|||||||
pts.addrs = pts.addrs[:0]
|
pts.addrs = pts.addrs[:0]
|
||||||
|
|
||||||
// Wait until work is complete
|
// Wait until work is complete
|
||||||
sbs := make([]*sortBlock, 0, len(pts.addrs))
|
sbs := make([]*sortBlock, 0, addrsLen)
|
||||||
var firstErr error
|
var firstErr error
|
||||||
for _, upw := range upws {
|
for _, upw := range upws {
|
||||||
if err := <-upw.doneCh; err != nil && firstErr == nil {
|
if err := <-upw.doneCh; err != nil && firstErr == nil {
|
||||||
|
Loading…
Reference in New Issue
Block a user