MCPcopy Create free account
hub / github.com/Super-long/ChubbyGo / BenchmarkPutGet_SyncMap

Function BenchmarkPutGet_SyncMap

MapPerformanceTest/test_test.go:324–342  ·  view source on GitHub ↗

(Sync.map)

(b *testing.B)

Source from the content-addressed store, hash-verified

322
323// (Sync.map)
324func BenchmarkPutGet_SyncMap(b *testing.B){
325 syncMap := &sync.Map{}
326
327 groups := sync.WaitGroup{}
328 groups.Add(ThreadNumber)
329
330 b.ResetTimer()
331
332 for j:=0; j < ThreadNumber; j++{
333 go func(){
334 for i := 0; i < b.N; i++ {
335 syncMap.Store(strconv.Itoa(i), "lizhaolong")
336 syncMap.Load(strconv.Itoa(i-1))
337 }
338 groups.Done()
339 }()
340 }
341 groups.Wait()
342}
343
344// (chubbyGoMap.ConcurrentMap)
345func BenchmarkPutGet_ChubbyGo_ConcurrentMap(b *testing.B){

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected