MCPcopy
hub / github.com/lindb/lindb / Benchmark_LoadAtomicValue

Function Benchmark_LoadAtomicValue

tsdb/database_test.go:557–573  ·  view source on GitHub ↗
(b *testing.B)

Source from the content-addressed store, hash-verified

555}
556
557func Benchmark_LoadAtomicValue(b *testing.B) {
558 var v atomic.Value
559 l := make([]*shard, boundaryShardSetLen)
560 v.Store(l)
561
562 // 2.631ns
563 b.RunParallel(func(pb *testing.PB) {
564 for pb.Next() {
565 list := v.Load().([]*shard)
566 for i := 0; i < boundaryShardSetLen; i++ {
567 if i == boundaryShardSetLen-1 {
568 _ = list[boundaryShardSetLen-1]
569 }
570 }
571 }
572 })
573}
574
575func Benchmark_SyncRWMutex(b *testing.B) {
576 var lock sync.RWMutex

Callers

nothing calls this directly

Calls 2

NextMethod · 0.65
LoadMethod · 0.65

Tested by

no test coverage detected