ソースを参照

query: Pre-allocate the routing key buffer

Adrien Bustany 10 年 前
コミット
8d6c5d85f6
1 ファイル変更1 行追加1 行削除
  1. 1 1
      session.go

+ 1 - 1
session.go

@@ -533,7 +533,7 @@ func (q *Query) GetRoutingKey() ([]byte, error) {
 	}
 
 	// composite routing key
-	buf := &bytes.Buffer{}
+	buf := bytes.NewBuffer(make([]byte, 0, 256))
 	for i := range routingKeyInfo.indexes {
 		encoded, err := Marshal(
 			routingKeyInfo.types[i],