MCPcopy Index your code
hub / github.com/aceld/zinx / benchmarkMultiGetSetBlockWithMap

Function benchmarkMultiGetSetBlockWithMap

zutils/shard_lock_map_bench_test.go:336–350  ·  view source on GitHub ↗
(slm ShardLockMaps, b *testing.B)

Source from the content-addressed store, hash-verified

334}
335
336func benchmarkMultiGetSetBlockWithMap(slm ShardLockMaps, b *testing.B) {
337 finished := make(chan struct{}, 2*b.N)
338 get, set := GetSet(slm, finished)
339 for i := 0; i < 100; i++ {
340 set(strconv.Itoa(i), "value")
341 }
342 b.ResetTimer()
343 for i := 0; i < b.N; i++ {
344 go set(strconv.Itoa(i%100), "value")
345 go get(strconv.Itoa(i%100), "value")
346 }
347 for i := 0; i < 2*b.N; i++ {
348 <-finished
349 }
350}

Calls 1

GetSetFunction · 0.85

Tested by

no test coverage detected