(b *testing.B)
| 555 | } |
| 556 | |
| 557 | func 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 | |
| 575 | func Benchmark_SyncRWMutex(b *testing.B) { |
| 576 | var lock sync.RWMutex |