MCPcopy Create free account
hub / github.com/GoEdgeLab/EdgeNode / BenchmarkNewIntMap2

Function BenchmarkNewIntMap2

internal/utils/sync/map_int_test.go:108–125  ·  view source on GitHub ↗
(b *testing.B)

Source from the content-addressed store, hash-verified

106}
107
108func BenchmarkNewIntMap2(b *testing.B) {
109 var m = map[int]*stats.BandwidthStat{}
110 var locker = sync.RWMutex{}
111
112 b.RunParallel(func(pb *testing.PB) {
113 var i int
114 for pb.Next() {
115 i++
116 locker.Lock()
117 m[i] = &stats.BandwidthStat{ServerId: 100}
118 locker.Unlock()
119
120 locker.RLock()
121 _ = m[i+100]
122 locker.RUnlock()
123 }
124 })
125}

Callers

nothing calls this directly

Calls 5

NextMethod · 0.80
RLockMethod · 0.80
RUnlockMethod · 0.80
LockMethod · 0.45
UnlockMethod · 0.45

Tested by

no test coverage detected