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

Function BenchmarkDelete_ConcurrentMap

MapPerformanceTest/test_test.go:409–427  ·  view source on GitHub ↗

(ConcurrentMap)

(b *testing.B)

Source from the content-addressed store, hash-verified

407
408//(ConcurrentMap)
409func BenchmarkDelete_ConcurrentMap(b *testing.B){
410 Map := BaseServer.NewConcurrentMap()
411
412 groups := sync.WaitGroup{}
413 groups.Add(ThreadNumber)
414
415 b.ResetTimer()
416
417 for j:=0; j < ThreadNumber; j++{
418 go func(){
419 for i := 0; i < b.N; i++ {
420 Map.Set(strconv.Itoa(i), "lizhaolong")
421 Map.Remove(strconv.Itoa(i-1))
422 }
423 groups.Done()
424 }()
425 }
426 groups.Wait()
427}
428
429// (Sync.map)
430func BenchmarkDelete_SyncMap(b *testing.B){

Callers

nothing calls this directly

Calls 2

SetMethod · 0.80
RemoveMethod · 0.80

Tested by

no test coverage detected