MCPcopy Create free account
hub / github.com/Azure/peerd / BenchmarkSyncMap

Function BenchmarkSyncMap

pkg/cache/syncmap_test.go:105–122  ·  view source on GitHub ↗
(b *testing.B)

Source from the content-addressed store, hash-verified

103}
104
105func BenchmarkSyncMap(b *testing.B) {
106 sm := NewSyncMap(100)
107 b.Run("Add", func(b *testing.B) {
108 for i := 0; i < b.N; i++ {
109 sm.Set(fmt.Sprintf("%d", i), i)
110 }
111 })
112 b.Run("Get", func(b *testing.B) {
113 for i := 0; i < b.N; i++ {
114 sm.Get(fmt.Sprintf("%d", i))
115 }
116 })
117 b.Run("Delete", func(b *testing.B) {
118 for i := 0; i < b.N; i++ {
119 sm.Delete(fmt.Sprintf("%d", i))
120 }
121 })
122}

Callers

nothing calls this directly

Calls 4

SetMethod · 0.95
GetMethod · 0.95
DeleteMethod · 0.95
NewSyncMapFunction · 0.85

Tested by

no test coverage detected