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

Function BenchmarkDelete_SyncMap

MapPerformanceTest/test_test.go:430–448  ·  view source on GitHub ↗

(Sync.map)

(b *testing.B)

Source from the content-addressed store, hash-verified

428
429// (Sync.map)
430func BenchmarkDelete_SyncMap(b *testing.B){
431 syncMap := &sync.Map{}
432
433 groups := sync.WaitGroup{}
434 groups.Add(ThreadNumber)
435
436 b.ResetTimer()
437
438 for j:=0; j < ThreadNumber; j++{
439 go func(){
440 for i := 0; i < b.N; i++ {
441 syncMap.Store(strconv.Itoa(i), "lizhaolong")
442 syncMap.Delete(strconv.Itoa(i-1))
443 }
444 groups.Done()
445 }()
446 }
447 groups.Wait()
448}
449
450// (chubbyGoMap.ConcurrentMap)
451func BenchmarkDelete_ChubbyGo_ConcurrentMap(b *testing.B){

Callers

nothing calls this directly

Calls 1

DeleteMethod · 0.45

Tested by

no test coverage detected