From cfe305296f8072b76ffb5d79f91c4d2ca85964e9 Mon Sep 17 00:00:00 2001 From: Vladimir Mihailenco Date: Wed, 15 Aug 2018 09:10:53 +0300 Subject: [PATCH] Bench bigget values --- bench_test.go | 2 ++ internal/pool/conn.go | 5 +++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/bench_test.go b/bench_test.go index dc2299b7..933f5cba 100644 --- a/bench_test.go +++ b/bench_test.go @@ -69,11 +69,13 @@ func BenchmarkRedisSetString(b *testing.B) { {10, 1024}, {10, 64 * 1024}, {10, 1024 * 1024}, + {10, 10 * 1024 * 1024}, {100, 64}, {100, 1024}, {100, 64 * 1024}, {100, 1024 * 1024}, + {100, 10 * 1024 * 1024}, } for _, bm := range benchmarks { b.Run(bm.String(), func(b *testing.B) { diff --git a/internal/pool/conn.go b/internal/pool/conn.go index 4e3a608e..a70e818f 100644 --- a/internal/pool/conn.go +++ b/internal/pool/conn.go @@ -81,10 +81,11 @@ func (cn *Conn) EnableConcurrentReadWrite() { } func (cn *Conn) PrepareWriteBuffer() *proto.WriteBuffer { - if !cn.concurrentReadWrite { + if cn.concurrentReadWrite { + cn.wb.Reset() + } else { cn.wb.ResetBuffer(cn.Rd.Buffer()) } - cn.wb.Reset() return cn.wb }