Browse Source

query: Pre-allocate the routing key buffer

Adrien Bustany 10 years ago
parent
commit
8d6c5d85f6
1 changed files with 1 additions and 1 deletions
  1. 1 1
      session.go

+ 1 - 1
session.go

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