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

Function BenchmarkPutKeyNoExist_BaseMap

MapPerformanceTest/test_test.go:28–45  ·  view source on GitHub ↗

*1.--------------测试Put操作--------------*/ 在此测试中冲突键较多,对并发的map并不有利 (BaseMap)

(b *testing.B)

Source from the content-addressed store, hash-verified

26
27//(BaseMap)
28func BenchmarkPutKeyNoExist_BaseMap(b *testing.B){
29 Map := BaseServer.NewBaseMap()
30
31 groups := sync.WaitGroup{}
32 groups.Add(ThreadNumber)
33
34 b.ResetTimer()
35
36 for j:=0; j < ThreadNumber; j++{
37 go func(){
38 for i := 0; i < b.N; i++ {
39 Map.BaseStore(strconv.Itoa(i), "lizhaolong")
40 }
41 groups.Done()
42 }()
43 }
44 groups.Wait()
45}
46
47//(ConcurrentMap)
48func BenchmarkPutKeyNoExist_ConcurrentMap(b *testing.B){

Callers

nothing calls this directly

Calls 1

BaseStoreMethod · 0.95

Tested by

no test coverage detected