MCPcopy Create free account
hub / github.com/baidu/EasyFaaS / BenchmarkRWMutexMapSetDelete

Function BenchmarkRWMutexMapSetDelete

pkg/util/cache/cache_test.go:1632–1645  ·  view source on GitHub ↗
(b *testing.B)

Source from the content-addressed store, hash-verified

1630}
1631
1632func BenchmarkRWMutexMapSetDelete(b *testing.B) {
1633 b.StopTimer()
1634 m := map[string]string{}
1635 mu := sync.RWMutex{}
1636 b.StartTimer()
1637 for i := 0; i < b.N; i++ {
1638 mu.Lock()
1639 m["foo"] = "bar"
1640 mu.Unlock()
1641 mu.Lock()
1642 delete(m, "foo")
1643 mu.Unlock()
1644 }
1645}
1646
1647func BenchmarkCacheSetDeleteSingleLock(b *testing.B) {
1648 b.StopTimer()

Callers

nothing calls this directly

Calls 1

LockMethod · 0.80

Tested by

no test coverage detected