2
0
mirror of https://github.com/etcd-io/etcd.git synced 2024-09-27 06:25:44 +00:00

25 lines
358 B
Go

package storage
import (
"crypto/rand"
"os"
"testing"
)
func BenchmarkStorePut(b *testing.B) {
s := newStore("test")
defer os.Remove("test")
// prepare keys
keys := make([][]byte, b.N)
for i := 0; i < b.N; i++ {
keys[i] = make([]byte, 64)
rand.Read(keys[i])
}
b.ResetTimer()
for i := 0; i < b.N; i++ {
s.Put(keys[i], []byte("foo"))
}
}