Merge pull request #860 from steveyen/optimize-docInternalToNumber
optimize docInternalToNumber() to avoid allocations
This commit is contained in:
commit
7a98d75fc5
|
@ -413,12 +413,10 @@ func docNumberToBytes(buf []byte, in uint64) []byte {
|
|||
}
|
||||
|
||||
func docInternalToNumber(in index.IndexInternalID) (uint64, error) {
|
||||
var res uint64
|
||||
err := binary.Read(bytes.NewReader(in), binary.BigEndian, &res)
|
||||
if err != nil {
|
||||
return 0, err
|
||||
if len(in) != 8 {
|
||||
return 0, fmt.Errorf("wrong len for IndexInternalID: %q", in)
|
||||
}
|
||||
return res, nil
|
||||
return binary.BigEndian.Uint64(in), nil
|
||||
}
|
||||
|
||||
func (i *IndexSnapshot) DocumentVisitFieldTerms(id index.IndexInternalID,
|
||||
|
|
Loading…
Reference in New Issue