From fc7584f5a012ff5919156ecc8a0a414985218883 Mon Sep 17 00:00:00 2001 From: Steve Yen Date: Fri, 23 Mar 2018 16:56:37 -0700 Subject: [PATCH] scorch zap prealloc extra locs for future growth --- index/scorch/segment/zap/posting.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/index/scorch/segment/zap/posting.go b/index/scorch/segment/zap/posting.go index e994617a..cf1e1ab0 100644 --- a/index/scorch/segment/zap/posting.go +++ b/index/scorch/segment/zap/posting.go @@ -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++ {