mirror of
https://github.com/redis/go-redis.git
synced 2025-07-28 06:42:00 +03:00
commands: reduce memory allocations in ZAdd.
This commit is contained in:
committed by
Vladimir Mihailenco
parent
bbfbc5f668
commit
5f85be3173
@ -267,3 +267,20 @@ func BenchmarkPipeline(b *testing.B) {
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
func BenchmarkZAdd(b *testing.B) {
|
||||
client := redis.NewClient(&redis.Options{
|
||||
Addr: redisAddr,
|
||||
})
|
||||
defer client.Close()
|
||||
|
||||
b.ResetTimer()
|
||||
|
||||
b.RunParallel(func(pb *testing.PB) {
|
||||
for pb.Next() {
|
||||
if err := client.ZAdd("key", redis.Z{float64(1), "hello"}).Err(); err != nil {
|
||||
b.Fatal(err)
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
Reference in New Issue
Block a user