Parcourir la source

query: Pre-allocate the routing key buffer

Adrien Bustany il y a 10 ans
Parent
commit
8d6c5d85f6
1 fichiers modifiés avec 1 ajouts et 1 suppressions
  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],