1
0
mirror of https://github.com/redis/go-redis.git synced 2025-07-31 05:04:23 +03:00

Use single read and write buffer where possible

This commit is contained in:
Vladimir Mihailenco
2018-08-04 12:19:19 +03:00
parent ad7024da36
commit b576fe91a1
11 changed files with 368 additions and 106 deletions

View File

@ -1,6 +1,7 @@
package proto_test
import (
"strings"
"testing"
"time"
@ -14,7 +15,7 @@ var _ = Describe("WriteBuffer", func() {
var buf *proto.WriteBuffer
BeforeEach(func() {
buf = proto.NewWriteBuffer()
buf = proto.NewWriteBuffer(proto.NewBufioReader(strings.NewReader("")))
})
It("should reset", func() {
@ -53,7 +54,7 @@ var _ = Describe("WriteBuffer", func() {
})
func BenchmarkWriteBuffer_Append(b *testing.B) {
buf := proto.NewWriteBuffer()
buf := proto.NewWriteBuffer(proto.NewBufioReader(strings.NewReader("")))
args := []interface{}{"hello", "world", "foo", "bar"}
for i := 0; i < b.N; i++ {