MCPcopy Create free account
hub / github.com/couchbase/moss / BenchmarkCollectionSnapshotGets

Function BenchmarkCollectionSnapshotGets

benchmark_get_test.go:18–41  ·  view source on GitHub ↗
(b *testing.B)

Source from the content-addressed store, hash-verified

16)
17
18func BenchmarkCollectionSnapshotGets(b *testing.B) {
19 tmpDir, _ := ioutil.TempDir("", "benchStore")
20 defer os.RemoveAll(tmpDir)
21
22 store, coll, keys := createStoreAndWriteNItems(tmpDir, 10000, 100)
23 defer store.Close()
24 defer coll.Close()
25
26 b.ResetTimer()
27
28 for i := 0; i < b.N; i++ {
29 ss, err := coll.Snapshot()
30 if err != nil || ss == nil {
31 panic("Snapshot() failed!")
32 }
33
34 _, err = ss.Get(keys[i%len(keys)], ReadOptions{})
35 if err != nil {
36 panic("Snapshot-Get() failed!")
37 }
38
39 ss.Close()
40 }
41}
42
43func BenchmarkCollectionGets(b *testing.B) {
44 tmpDir, _ := ioutil.TempDir("", "benchStore")

Callers

nothing calls this directly

Calls 4

CloseMethod · 0.65
SnapshotMethod · 0.65
GetMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…