mvcc: benchmark Range() on a single key

release-3.3
Anthony Romano 2017-08-20 22:06:03 -07:00
parent a9e56e103c
commit 10b65c97dd
1 changed files with 19 additions and 0 deletions

View File

@ -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) {
fci := fakeConsistentIndex(10)
be, tmpPath := backend.NewDefaultTmpBackend()