watcher_bench_test.go 281 B

1234567891011121314151617
  1. package storage
  2. import (
  3. "fmt"
  4. "testing"
  5. )
  6. func BenchmarkKVWatcherMemoryUsage(b *testing.B) {
  7. s := newWatchableStore(tmpPath)
  8. defer cleanup(s, tmpPath)
  9. b.ReportAllocs()
  10. b.StartTimer()
  11. for i := 0; i < b.N; i++ {
  12. s.Watcher([]byte(fmt.Sprint("foo", i)), false, 0, 0)
  13. }
  14. }