scorch zap mergeStoredAndRemap loop optimization
This change avoids an array/slice access in a loop body.
This commit is contained in:
parent
eb1d269521
commit
0dfd73d6cc
|
@ -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
|
||||||
|
|
Loading…
Reference in New Issue