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

More benchmarks.

This commit is contained in:
Vladimir Mihailenco
2016-03-10 11:10:47 +02:00
parent eb78eedafe
commit b90cea8e8d
6 changed files with 321 additions and 224 deletions

View File

@ -3,7 +3,6 @@ package redis_test
import (
"errors"
"sync"
"testing"
"time"
. "github.com/onsi/ginkgo"
@ -210,24 +209,3 @@ var _ = Describe("pool", func() {
Expect(rateErr).To(MatchError(`redis: you open connections too fast (last_error="test")`))
})
})
func BenchmarkPool(b *testing.B) {
client := benchRedisClient()
defer client.Close()
pool := client.Pool()
b.ResetTimer()
b.RunParallel(func(pb *testing.PB) {
for pb.Next() {
conn, _, err := pool.Get()
if err != nil {
b.Fatalf("no error expected on pool.Get but received: %s", err.Error())
}
if err = pool.Put(conn); err != nil {
b.Fatalf("no error expected on pool.Put but received: %s", err.Error())
}
}
})
}