MCPcopy
hub / github.com/aceld/zinx / benchmarkMultiGetSetDifferent

Function benchmarkMultiGetSetDifferent

zutils/shard_lock_map_bench_test.go:251–264  ·  view source on GitHub ↗
(b *testing.B)

Source from the content-addressed store, hash-verified

249}
250
251func benchmarkMultiGetSetDifferent(b *testing.B) {
252 slm := NewShardLockMaps()
253 finished := make(chan struct{}, 2*b.N)
254 get, set := GetSet(slm, finished)
255 slm.Set("-1", "value")
256 b.ResetTimer()
257 for i := 0; i < b.N; i++ {
258 go set(strconv.Itoa(i-1), "value")
259 go get(strconv.Itoa(i), "value")
260 }
261 for i := 0; i < 2*b.N; i++ {
262 <-finished
263 }
264}
265
266func benchmarkMultiGetSetBlock(b *testing.B) {
267 slm := NewShardLockMaps()

Callers

nothing calls this directly

Calls 3

SetMethod · 0.95
NewShardLockMapsFunction · 0.85
GetSetFunction · 0.85

Tested by

no test coverage detected