MCPcopy Create free account
hub / github.com/dgraph-io/dgraph / BenchmarkXidmapReads

Function BenchmarkXidmapReads

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

Source from the content-addressed store, hash-verified

194}
195
196func BenchmarkXidmapReads(b *testing.B) {
197 conn, err := x.SetupConnection(testutil.GetSockAddrZero(), nil, false)
198 if err != nil {
199 b.Fatalf("Error setting up connection: %s", err.Error())
200 }
201
202 var N = 1000000
203 xidmap := New(getTestXidmapOpts(conn, nil))
204 defer xidmap.Flush()
205 for i := 0; i < N; i++ {
206 xidmap.AssignUid("xid-" + strconv.Itoa(i))
207 }
208 b.ResetTimer()
209
210 b.RunParallel(func(pb *testing.PB) {
211 for pb.Next() {
212 xid := int(z.FastRand()) % N
213 xidmap.AssignUid("xid-" + strconv.Itoa(xid))
214 }
215 })
216}
217
218func BenchmarkXidmapReadsRandom(b *testing.B) {
219 conn, err := x.SetupConnection(testutil.GetSockAddrZero(), nil, false)

Callers

nothing calls this directly

Calls 9

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

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…