0
0
Fork 0

scorch zap mergeStoredAndRemap loop optimization

This change avoids an array/slice access in a loop body.
This commit is contained in:
Steve Yen 2018-02-06 17:10:41 -08:00
parent eb1d269521
commit 0dfd73d6cc
1 changed files with 4 additions and 4 deletions

View File

@ -506,17 +506,17 @@ func mergeStoredAndRemap(segments []*Segment, drops []*roaring.Bitmap,
}
// return value is the start of the stored index
offset := uint64(w.Count())
storedIndexOffset := uint64(w.Count())
// now write out the stored doc index
for docNum := range docNumOffsets {
err := binary.Write(w, binary.BigEndian, docNumOffsets[docNum])
for _, docNumOffset := range docNumOffsets {
err := binary.Write(w, binary.BigEndian, docNumOffset)
if err != nil {
return 0, nil, err
}
}
return offset, rv, nil
return storedIndexOffset, rv, nil
}
// mergeFields builds a unified list of fields used across all the input segments