Use strconv.FormatInt() directly to convert key to string w/o using expensive fmt.Sprintf().

This commit is contained in:
Sascha L. Teichmann 2014-08-17 12:08:26 +02:00
parent 6efb976ba2
commit da5c70b55b

View File

@ -5,7 +5,6 @@
package common package common
import ( import (
"fmt"
"strconv" "strconv"
) )
@ -16,5 +15,5 @@ func DecodePosFromBytes(key []byte) (pos int64, err error) {
// Encode a block pos to byte slice. // Encode a block pos to byte slice.
func EncodePosToBytes(key int64) []byte { func EncodePosToBytes(key int64) []byte {
return []byte(fmt.Sprintf("%d", key)) return []byte(strconv.FormatInt(key, 10))
} }