MCPcopy Create free account
hub / github.com/evilsocket/sum / BenchmarkIndexDeleteRecord

Function BenchmarkIndexDeleteRecord

storage/index_benchmark_test.go:102–123  ·  view source on GitHub ↗
(b *testing.B)

Source from the content-addressed store, hash-verified

100}
101
102func BenchmarkIndexDeleteRecord(b *testing.B) {
103 defer teardownRecords(b)
104
105 var idx *Index
106 for i := 0; i < b.N; i++ {
107 // this is not entirely ok as once every 5 times
108 // we neeed to recreate and reload records, which
109 // increases the operations being benchmarked
110 id := uint64(i%testRecords) + 1
111 if id == 1 {
112 setupRecords(b, true, false)
113 idx = setupIndex(testFolder)
114 if err := idx.Load(); err != nil {
115 b.Fatal(err)
116 }
117 }
118
119 if m := idx.Delete(id); m == nil {
120 b.Fatal("unexpected nil response")
121 }
122 }
123}

Callers

nothing calls this directly

Calls 5

LoadMethod · 0.95
DeleteMethod · 0.95
setupIndexFunction · 0.85
teardownRecordsFunction · 0.70
setupRecordsFunction · 0.70

Tested by

no test coverage detected