From 9982d13cca7d1a7e2a0fe13897f8e6f26fba6d77 Mon Sep 17 00:00:00 2001
From: Manish R Jain <manishrjain@gmail.com>
Date: Thu, 3 Mar 2016 04:52:16 +0000
Subject: [PATCH] Decrease memory allocations or buffer growth.

---
 posting/list.go | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/posting/list.go b/posting/list.go
index cef683f1..73aa2d2f 100644
--- a/posting/list.go
+++ b/posting/list.go
@@ -105,8 +105,7 @@ func samePosting(a *types.Posting, b *types.Posting) bool {
 
 // key = (entity uid, attribute)
 func Key(uid uint64, attr string) []byte {
-	buf := new(bytes.Buffer)
-	buf.WriteString(attr)
+	buf := bytes.NewBufferString(attr)
 	if err := binary.Write(buf, binary.LittleEndian, uid); err != nil {
 		glog.Fatalf("Error while creating key with attr: %v uid: %v\n", attr, uid)
 	}
-- 
GitLab