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 // return value is the start of the stored index
offset := uint64(w.Count()) storedIndexOffset := uint64(w.Count())
// now write out the stored doc index // now write out the stored doc index
for docNum := range docNumOffsets { for _, docNumOffset := range docNumOffsets {
err := binary.Write(w, binary.BigEndian, docNumOffsets[docNum]) err := binary.Write(w, binary.BigEndian, docNumOffset)
if err != nil { if err != nil {
return 0, nil, err 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 // mergeFields builds a unified list of fields used across all the input segments