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

Function BenchmarkPutGet_BaseMap

MapPerformanceTest/test_test.go:282–300  ·  view source on GitHub ↗

*3.--------------测试并发Get,put操作--------------*/ (BaseMap)

(b *testing.B)

Source from the content-addressed store, hash-verified

280
281//(BaseMap)
282func BenchmarkPutGet_BaseMap(b *testing.B){
283 Map := BaseServer.NewBaseMap()
284
285 groups := sync.WaitGroup{}
286 groups.Add(ThreadNumber)
287
288 b.ResetTimer()
289
290 for j:=0; j < ThreadNumber; j++{
291 go func(){
292 for i := 0; i < b.N; i++ {
293 Map.BaseStore(strconv.Itoa(i), "lizhaolong")
294 Map.BaseGet(strconv.Itoa(i-1))
295 }
296 groups.Done()
297 }()
298 }
299 groups.Wait()
300}
301
302//(ConcurrentMap)
303func BenchmarkPutGet_ConcurrentMap(b *testing.B){

Callers

nothing calls this directly

Calls 2

BaseStoreMethod · 0.95
BaseGetMethod · 0.95

Tested by

no test coverage detected