Skip to content
Snippets Groups Projects
Commit 9982d13c authored by Manish R Jain's avatar Manish R Jain
Browse files

Decrease memory allocations or buffer growth.

parent 2678fd40
No related branches found
No related tags found
No related merge requests found
...@@ -105,8 +105,7 @@ func samePosting(a *types.Posting, b *types.Posting) bool { ...@@ -105,8 +105,7 @@ func samePosting(a *types.Posting, b *types.Posting) bool {
// key = (entity uid, attribute) // key = (entity uid, attribute)
func Key(uid uint64, attr string) []byte { func Key(uid uint64, attr string) []byte {
buf := new(bytes.Buffer) buf := bytes.NewBufferString(attr)
buf.WriteString(attr)
if err := binary.Write(buf, binary.LittleEndian, uid); err != nil { if err := binary.Write(buf, binary.LittleEndian, uid); err != nil {
glog.Fatalf("Error while creating key with attr: %v uid: %v\n", attr, uid) glog.Fatalf("Error while creating key with attr: %v uid: %v\n", attr, uid)
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment