Merge pull request #5238 from xiang90/bench_watch_put
mvcc: add benchmark for watch put and improve itrelease-3.0
commit
262de75a7e
|
@ -580,7 +580,7 @@ func (s *store) delete(key []byte, rev revision) {
|
||||||
|
|
||||||
func (s *store) getChanges() []mvccpb.KeyValue {
|
func (s *store) getChanges() []mvccpb.KeyValue {
|
||||||
changes := s.changes
|
changes := s.changes
|
||||||
s.changes = make([]mvccpb.KeyValue, 0, 128)
|
s.changes = make([]mvccpb.KeyValue, 0, 4)
|
||||||
return changes
|
return changes
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -23,6 +23,22 @@ import (
|
||||||
"github.com/coreos/etcd/mvcc/backend"
|
"github.com/coreos/etcd/mvcc/backend"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
func BenchmarkWatchableStorePut(b *testing.B) {
|
||||||
|
be, tmpPath := backend.NewDefaultTmpBackend()
|
||||||
|
s := New(be, &lease.FakeLessor{}, nil)
|
||||||
|
defer cleanup(s, be, tmpPath)
|
||||||
|
|
||||||
|
// arbitrary number of bytes
|
||||||
|
bytesN := 64
|
||||||
|
keys := createBytesSlice(bytesN, b.N)
|
||||||
|
vals := createBytesSlice(bytesN, b.N)
|
||||||
|
|
||||||
|
b.ResetTimer()
|
||||||
|
for i := 0; i < b.N; i++ {
|
||||||
|
s.Put(keys[i], vals[i], lease.NoLease)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Benchmarks on cancel function performance for unsynced watchers
|
// Benchmarks on cancel function performance for unsynced watchers
|
||||||
// in a WatchableStore. It creates k*N watchers to populate unsynced
|
// in a WatchableStore. It creates k*N watchers to populate unsynced
|
||||||
// with a reasonably large number of watchers. And measures the time it
|
// with a reasonably large number of watchers. And measures the time it
|
||||||
|
|
Loading…
Reference in New Issue