(ConcurrentMap)
(b *testing.B)
| 407 | |
| 408 | //(ConcurrentMap) |
| 409 | func BenchmarkDelete_ConcurrentMap(b *testing.B){ |
| 410 | Map := BaseServer.NewConcurrentMap() |
| 411 | |
| 412 | groups := sync.WaitGroup{} |
| 413 | groups.Add(ThreadNumber) |
| 414 | |
| 415 | b.ResetTimer() |
| 416 | |
| 417 | for j:=0; j < ThreadNumber; j++{ |
| 418 | go func(){ |
| 419 | for i := 0; i < b.N; i++ { |
| 420 | Map.Set(strconv.Itoa(i), "lizhaolong") |
| 421 | Map.Remove(strconv.Itoa(i-1)) |
| 422 | } |
| 423 | groups.Done() |
| 424 | }() |
| 425 | } |
| 426 | groups.Wait() |
| 427 | } |
| 428 | |
| 429 | // (Sync.map) |
| 430 | func BenchmarkDelete_SyncMap(b *testing.B){ |