(ConcurrentMap)
(b *testing.B)
| 46 | |
| 47 | //(ConcurrentMap) |
| 48 | func BenchmarkPutKeyNoExist_ConcurrentMap(b *testing.B){ |
| 49 | Map := BaseServer.NewConcurrentMap() |
| 50 | |
| 51 | groups := sync.WaitGroup{} |
| 52 | groups.Add(ThreadNumber) |
| 53 | |
| 54 | b.ResetTimer() |
| 55 | |
| 56 | for j:=0; j < ThreadNumber; j++{ |
| 57 | go func(){ |
| 58 | for i := 0; i < b.N; i++ { |
| 59 | Map.Set(strconv.Itoa(i), "lizhaolong") |
| 60 | } |
| 61 | groups.Done() |
| 62 | }() |
| 63 | } |
| 64 | groups.Wait() |
| 65 | } |
| 66 | |
| 67 | // (Sync.map) |
| 68 | func BenchmarkPutKeyNoExist_SyncMap(b *testing.B){ |