Explorar el Código

query: Pre-allocate the routing key buffer

Adrien Bustany hace 10 años
padre
commit
8d6c5d85f6
Se han modificado 1 ficheros con 1 adiciones y 1 borrados
  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],