(Sync.map)
(b *testing.B)
| 322 | |
| 323 | // (Sync.map) |
| 324 | func 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) |
| 345 | func BenchmarkPutGet_ChubbyGo_ConcurrentMap(b *testing.B){ |
nothing calls this directly
no outgoing calls
no test coverage detected