MCPcopy
hub / github.com/dgraph-io/dgraph / BenchmarkXidmapWritesRandom

Function BenchmarkXidmapWritesRandom

xidmap/xidmap_test.go:175–194  ·  view source on GitHub ↗
(b *testing.B)

Source from the content-addressed store, hash-verified

173}
174
175func BenchmarkXidmapWritesRandom(b *testing.B) {
176 conn, err := x.SetupConnection(testutil.GetSockAddrZero(), nil, false)
177 if err != nil {
178 b.Fatalf("Error setting up connection: %s", err.Error())
179 }
180
181 xidmap := New(getTestXidmapOpts(conn, nil))
182 defer xidmap.Flush()
183 b.ResetTimer()
184 buf := make([]byte, 32)
185
186 b.RunParallel(func(pb *testing.PB) {
187 source := rand.NewSource(time.Now().UnixNano())
188 r := rand.New(source)
189 for pb.Next() {
190 r.Read(buf)
191 xidmap.AssignUid(string(buf))
192 }
193 })
194}
195
196func BenchmarkXidmapReads(b *testing.B) {
197 conn, err := x.SetupConnection(testutil.GetSockAddrZero(), nil, false)

Callers

nothing calls this directly

Calls 10

SetupConnectionFunction · 0.92
GetSockAddrZeroFunction · 0.92
getTestXidmapOptsFunction · 0.85
FatalfMethod · 0.80
AssignUidMethod · 0.80
NewFunction · 0.70
FlushMethod · 0.65
ReadMethod · 0.65
ErrorMethod · 0.45
NextMethod · 0.45

Tested by

no test coverage detected