0
0
Fork 0

scorch zap prealloc extra locs for future growth

This commit is contained in:
Steve Yen 2018-03-23 16:56:37 -07:00
parent 3f4b161850
commit fc7584f5a0
1 changed files with 2 additions and 2 deletions

View File

@ -495,10 +495,10 @@ func (i *PostingsIterator) Next() (segment.Posting, error) {
if cap(i.nextLocs) >= int(rv.freq) {
i.nextLocs = i.nextLocs[0:rv.freq]
} else {
i.nextLocs = make([]Location, rv.freq)
i.nextLocs = make([]Location, rv.freq, rv.freq * 2)
}
if cap(i.nextSegmentLocs) < int(rv.freq) {
i.nextSegmentLocs = make([]segment.Location, rv.freq)
i.nextSegmentLocs = make([]segment.Location, rv.freq, rv.freq * 2)
}
rv.locs = i.nextSegmentLocs[0:rv.freq]
for j := 0; j < int(rv.freq); j++ {