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

Function BenchmarkPutGet_ConcurrentMap

MapPerformanceTest/test_test.go:303–321  ·  view source on GitHub ↗

(ConcurrentMap)

(b *testing.B)

Source from the content-addressed store, hash-verified

301
302//(ConcurrentMap)
303func BenchmarkPutGet_ConcurrentMap(b *testing.B){
304 Map := BaseServer.NewConcurrentMap()
305
306 groups := sync.WaitGroup{}
307 groups.Add(ThreadNumber)
308
309 b.ResetTimer()
310
311 for j:=0; j < ThreadNumber; j++{
312 go func(){
313 for i := 0; i < b.N; i++ {
314 Map.Set(strconv.Itoa(i), "lizhaolong")
315 Map.Get(strconv.Itoa(i-1))
316 }
317 groups.Done()
318 }()
319 }
320 groups.Wait()
321}
322
323// (Sync.map)
324func BenchmarkPutGet_SyncMap(b *testing.B){

Callers

nothing calls this directly

Calls 2

SetMethod · 0.80
GetMethod · 0.45

Tested by

no test coverage detected