1
0
mirror of https://github.com/redis/go-redis.git synced 2025-07-28 06:42:00 +03:00

Get rid of custom buffered reader.

This commit is contained in:
Vladimir Mihailenco
2012-08-09 13:12:41 +03:00
parent ea3677294b
commit b2e3463af1
8 changed files with 103 additions and 100 deletions

View File

@ -1964,20 +1964,23 @@ func (t *RedisTest) BenchmarkRedisMGet(c *C) {
func (t *RedisTest) BenchmarkRedisWriteRead(c *C) {
c.StopTimer()
req := []byte("PING\r\n")
conn, _, err := t.client.ConnPool.Get()
c.Check(err, IsNil)
for i := 0; i < 10; i++ {
err := t.client.WriteRead(req, conn)
err := t.client.WriteReq([]byte("PING\r\n"), conn)
c.Check(err, IsNil)
c.Check(conn.Rd.Bytes(), DeepEquals, []byte("+PONG\r\n"))
line, _, err := conn.Rd.ReadLine()
c.Check(err, IsNil)
c.Check(line, DeepEquals, []byte("+PONG"))
}
c.StartTimer()
for i := 0; i < c.N; i++ {
t.client.WriteRead(req, conn)
t.client.WriteReq([]byte("PING\r\n"), conn)
conn.Rd.ReadLine()
}
c.StopTimer()