0
0
Fork 0

scorch zap allocate govarint.U64Base128Encoder just once

Instead of allocating a govarint.U64Base128Encoder in the inner loop,
allocate it just once on the outside, as it appears that it's just a
thin wrapper around binary.PutUvarint().
This commit is contained in:
Steve Yen 2018-01-27 09:56:56 -08:00
parent 10dd5489c2
commit 9038d75c98
1 changed files with 2 additions and 2 deletions

View File

@ -390,6 +390,8 @@ func mergeStoredAndRemap(segments []*Segment, drops []*roaring.Bitmap,
var metaBuf bytes.Buffer
var data, compressed []byte
metaEncoder := govarint.NewU64Base128Encoder(&metaBuf)
vals := make([][][]byte, len(fieldsInv))
typs := make([][]byte, len(fieldsInv))
poss := make([][][]uint64, len(fieldsInv))
@ -407,8 +409,6 @@ func mergeStoredAndRemap(segments []*Segment, drops []*roaring.Bitmap,
compressed = compressed[:0]
curr = 0
metaEncoder := govarint.NewU64Base128Encoder(&metaBuf)
if drops[segI] != nil && drops[segI].Contains(uint32(docNum)) {
segNewDocNums = append(segNewDocNums, docDropped)
} else {