mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
mvcc: benchmark Range() on a single key
This commit is contained in:
parent
a9e56e103c
commit
10b65c97dd
@ -45,6 +45,25 @@ func BenchmarkStorePut(b *testing.B) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func BenchmarkStoreRangeOneKey(b *testing.B) {
|
||||||
|
var i fakeConsistentIndex
|
||||||
|
be, tmpPath := backend.NewDefaultTmpBackend()
|
||||||
|
s := NewStore(be, &lease.FakeLessor{}, &i)
|
||||||
|
defer cleanup(s, be, tmpPath)
|
||||||
|
|
||||||
|
// 64 byte key/val
|
||||||
|
key, val := createBytesSlice(64, 1), createBytesSlice(64, 1)
|
||||||
|
s.Put(key[0], val[0], lease.NoLease)
|
||||||
|
// Force into boltdb tx instead of backend read tx.
|
||||||
|
s.Commit()
|
||||||
|
|
||||||
|
b.ReportAllocs()
|
||||||
|
b.ResetTimer()
|
||||||
|
for i := 0; i < b.N; i++ {
|
||||||
|
s.Range(key[0], nil, RangeOptions{})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func BenchmarkConsistentIndex(b *testing.B) {
|
func BenchmarkConsistentIndex(b *testing.B) {
|
||||||
fci := fakeConsistentIndex(10)
|
fci := fakeConsistentIndex(10)
|
||||||
be, tmpPath := backend.NewDefaultTmpBackend()
|
be, tmpPath := backend.NewDefaultTmpBackend()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user